Question

I'm getting the following error on a new Rails installation. I run bundle install and after installing a bunch of gems, I get an error upon trying to install bcrypt-ruby. I'm using a brand new Mac with OS X 10.8.2, latest Ruby (v1.9.3-p194), new Rails (v3.2.8) and standard Gemfile.

Installing activerecord (3.2.8)

Installing activeresource (3.2.8)

Installing bcrypt-ruby (3.0.1) with native extensions

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /Users/me/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb  creating Makefile

make compiling bcrypt_ext.c make: /usr/bin/gcc-4.2: No such file or directory make: * [bcrypt_ext.o] Error 1

Gem files will remain installed in /Users/me/.rvm/gems/ruby-1.9.3-p194@mygemset/gems/bcrypt-ruby-3.0.1 for inspection. Results logged to /Users/me/.rvm/gems/ruby-1.9.3-p194@mygemset/gems/bcrypt-ruby-3.0.1/ext/mri/gem_make.out An error occurred while installing bcrypt-ruby (3.0.1), and Bundler cannot continue. Make sure that gem install bcrypt-ruby -v '3.0.1' succeeds before bundling.

UPDATE: Forgot to mention, not only in this a brand new Mac with Mac OS X 10.8.2, but also brand new Xcode installed yesterday and with command line tools. I then installed RVM and brew.

Was it helpful?

Solution

Seems odd on a brand new Mac, with new OS and new RVM installation that I would need to do this.. but what worked was simply linking gcc-4.2 to gcc:

sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2

OTHER TIPS

For me, the following worked

gem uni bcrypt-ruby
gem i bcrypt-ruby --platform=ruby

Have you upgraded to Lion since you installed Ruby 1.9.3? If so it is probably linked to the wrong gcc.

Try uninstalling and reinstalling 1.9.3, I would suggest using rvm

rvm uninstall 1.9.3
rvm install 1.9.3

If that does not work you might have to implode rvm

rvm implode
bash -s stable < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer)
source ~/.bash_profile
rvm install 1.9.3
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top