rubygemsruby-on-rails-3.2bcryptbcrypt-ruby

Can't install bcrypt-ruby for new Rails installation


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.


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