Skip to content

Error on macOS Mojave while installing #15

Open

Description

@telmen

sudo gem install watchbuild
Building native extensions. This could take a while...
ERROR: Error installing watchbuild:
ERROR: Failed to build gem native extension.

current directory: /usr/local/lib/ruby/gems/2.6.0/gems/unf_ext-0.0.7.5/ext/unf_ext

/usr/local/opt/ruby/bin/ruby -I /usr/local/Cellar/ruby/2.6.0/lib/ruby/2.6.0 -r ./siteconf20190305-71068-fwf5h8.rb extconf.rb
checking for -lstdc++... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.

Provided configuration options:
--with-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/Cellar/ruby/2.6.0/bin/$(RUBY_BASE_NAME)
--with-static-libstdc++
--without-static-libstdc++
--with-stdc++lib
--without-stdc++lib
/usr/local/Cellar/ruby/2.6.0/lib/ruby/2.6.0/mkmf.rb:467:in try_do': The compiler failed to generate an executable file. (RuntimeError) You have to install development tools first. from /usr/local/Cellar/ruby/2.6.0/lib/ruby/2.6.0/mkmf.rb:552:in try_link0'
from /usr/local/Cellar/ruby/2.6.0/lib/ruby/2.6.0/mkmf.rb:570:in try_link' from /usr/local/Cellar/ruby/2.6.0/lib/ruby/2.6.0/mkmf.rb:789:in try_func'
from /usr/local/Cellar/ruby/2.6.0/lib/ruby/2.6.0/mkmf.rb:1016:in block in have_library' from /usr/local/Cellar/ruby/2.6.0/lib/ruby/2.6.0/mkmf.rb:959:in block in checking_for'
from /usr/local/Cellar/ruby/2.6.0/lib/ruby/2.6.0/mkmf.rb:361:in block (2 levels) in postpone' from /usr/local/Cellar/ruby/2.6.0/lib/ruby/2.6.0/mkmf.rb:331:in open'
from /usr/local/Cellar/ruby/2.6.0/lib/ruby/2.6.0/mkmf.rb:361:in block in postpone' from /usr/local/Cellar/ruby/2.6.0/lib/ruby/2.6.0/mkmf.rb:331:in open'
from /usr/local/Cellar/ruby/2.6.0/lib/ruby/2.6.0/mkmf.rb:357:in postpone' from /usr/local/Cellar/ruby/2.6.0/lib/ruby/2.6.0/mkmf.rb:958:in checking_for'
from /usr/local/Cellar/ruby/2.6.0/lib/ruby/2.6.0/mkmf.rb:1011:in have_library' from extconf.rb:6:in

'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

/usr/local/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-18/2.6.0/unf_ext-0.0.7.5/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /usr/local/lib/ruby/gems/2.6.0/gems/unf_ext-0.0.7.5 for inspection.
Results logged to /usr/local/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-18/2.6.0/unf_ext-0.0.7.5/gem_make.out

Activity

  1. Xgamefactory commented on Oct 6, 2019

    @Xgamefactory

    same here

  2. zntfdr commented on Oct 22, 2019

    @zntfdr

    I had the same issue.

    What did the trick for me was following this Stack Overflow answer that I quote here:

    For macOS 10.14 Mojave, make sure you have already installed command line tools via xcode-select --install and the run the following command to install std headers.

    sudo open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
    

    Now try your command again.

    Then I had other issues with Ruby but that's for another day 😆

  3. Krishna commented on May 1, 2020

    @Krishna

    I was running into a problem installing a gem dependency of fastlane on macOS 10.15.3 (Catalina), and google led me to this issue.

    @zntfdr solution doesn't work on Catalina.

    After a bit of googling I found this, which worked to fix my problem:

    $ export SDKROOT="$(xcrun --sdk macosx --show-sdk-path)"
    $ gem install unf_ext -v '0.0.7.5'
    

    I think this may also be relevant to this issue?

    Hope this helps.

  4. vaibhavhrt commented on Feb 11, 2021

    @vaibhavhrt

    macOS Big Sur

    Version 11.2.1

    Delete & reinstall Xcode command line developer tools

    sudo rm -rf /Library/Developer/CommandLineTools
    xcode-select --install
  5. leafOfTree commented on Dec 1, 2021

    @leafOfTree

    macOS Big Sur

    Version 11.2.1

    Delete & reinstall Xcode command line developer tools

    sudo rm -rf /Library/Developer/CommandLineTools
    xcode-select --install

    Great tip, which also works for version 12.0.1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions