3

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.

at.
  • 50,922
  • 104
  • 292
  • 461

3 Answers3

7

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
at.
  • 50,922
  • 104
  • 292
  • 461
2

For me, the following worked

gem uni bcrypt-ruby
gem i bcrypt-ruby --platform=ruby
eamo
  • 355
  • 4
  • 14
0

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
Dipak Panchal
  • 5,996
  • 4
  • 32
  • 68
  • It looks to me like you don't have make on your system. If you're using a Mac, you need to install the Xcode command line tools. – Dipak Panchal Sep 29 '12 at 08:45
  • Updated question to state that Xcode command line tools were installed. – at. Sep 29 '12 at 15:03
  • 5
    If you are going to copy / paste someone else's answer, atleast give credit http://stackoverflow.com/a/9084811/442695 – Bot Dec 12 '12 at 03:24