Error: extconf failed, exit code 1 [Ruby on Rails]

14,767

managed to solve this. I had upgraded to OS Mavericks recently and problem came up.

Have tried gem install bcrypt-ruby -v '3.1.2' in terminal but encountered same problem.

Thereafter, went to install Xcode on App Store as running Xcode-select --install in terminal failed as well (program can't be found).

Thus I chanced upon this thread and followed advice to run sudo ln -s /usr/bin/llvm-gcc /usr/bin/gcc-4.2 in terminal.

Thread: gem install pg doesn't work on OSX Lion

Thereafter I ran gem install bcrypt-ruby -v '3.1.2' and bundle install in terminal and all good for now. Hope this works. Actually I don't know what I am doing but hopefully it works. Can someone enlighten me what I am actually doing?

Share:
14,767
Steven L
Author by

Steven L

Just picked up programming and am excited about it. Lots of unknowns but thats exciting! :)

Updated on June 04, 2022

Comments

  • Steven L
    Steven L almost 2 years

    got an error while trying to install devise gem. Added gem "devise", "~> 3.2.2" to my Gemlist and went into terminal to do the following:

    Steven-Lims-MacBook-Pro:Pinteresting stevenlim$ bundle install
    Fetching gem metadata from https://rubygems.org/..........
    Fetching additional metadata from https://rubygems.org/..
    Resolving dependencies...
    Using rake (10.1.1)
    Using i18n (0.6.9)
    Using minitest (4.7.5)
    Using multi_json (1.8.4)
    Using atomic (1.1.14)
    Using thread_safe (0.1.3)
    Using tzinfo (0.3.38)
    Using activesupport (4.0.2)
    Using builder (3.1.4)
    Using erubis (2.7.0)
    Using rack (1.5.2)
    Using rack-test (0.6.2)
    Using actionpack (4.0.2)
    Using mime-types (1.25.1)
    Using polyglot (0.3.3)
    Using treetop (1.4.15)
    Using mail (2.5.4)
    Using actionmailer (4.0.2)
    Using activemodel (4.0.2)
    Using activerecord-deprecated_finders (1.0.3)
    Using arel (4.0.1)
    Using activerecord (4.0.2)
    
    Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
    
        /usr/local/rvm/rubies/ruby-2.0.0-p353/bin/ruby extconf.rb 
    checking for ruby/util.h... *** 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
        --without-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/rvm/rubies/ruby-2.0.0-p353/bin/ruby
    /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:434:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
    You have to install development tools first.
        from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:565:in `try_cpp'
        from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:1044:in `block in have_header'
        from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:895:in `block in checking_for'
        from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:340:in `block (2 levels) in postpone'
        from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:310:in `open'
        from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:340:in `block in postpone'
        from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:310:in `open'
        from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:336:in `postpone'
        from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:894:in `checking_for'
        from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:1043:in `have_header'
        from extconf.rb:14:in `<main>'
    
    extconf failed, exit code 1
    
    Gem files will remain installed in /usr/local/rvm/gems/ruby-2.0.0-p353/gems/bcrypt-ruby-3.1.2 for inspection.
    Results logged to /usr/local/rvm/gems/ruby-2.0.0-p353/extensions/x86_64-darwin-10/2.0.0/bcrypt-ruby-3.1.2/gem_make.out
    An error occurred while installing bcrypt-ruby (3.1.2), and Bundler cannot
    continue.
    Make sure that `gem install bcrypt-ruby -v '3.1.2'` succeeds before bundling.
    

    Am new to programming and Ruby on Rails so kindly assist. Thanks!

  • rkamun1
    rkamun1 about 10 years
    I'm not certain, but it seem that updating to xcode 5 gives the /usr/bin/llvm-gcc file while atomic is looking for the /usr/bin/llvm-gcc-4.2 file. When installing xcode 4, it symlinks /usr/bin/llvm-gcc-4.2 to /usr/bin/gcc-4.2. What you did now is symlink /usr/bin/llvm-gcc- to /usr/bin/gcc-4.2.