ruby-on-railsrubygemsbundlerbcryptbcrypt-ruby

Why won't the bcrypt ruby gem install properly?


I am trying to encorporate bcrypt-ruby, v. 3.0.1. I enter the gem in my gem file as follows:

gem 'bcrypt-ruby', '3.0.1'

And I then go to the terminal and run:

bundle install

I get the following response:

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

    /usr/local/rvm/rubies/ruby-1.9.3-p392/bin/ruby extconf.rb 
creating Makefile

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


Gem files will remain installed in /Users/philip7899/.bundler/tmp/2186/gems/bcrypt-ruby-3.0.1 for inspection.
Results logged to /Users/philip7899/.bundler/tmp/2186/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.

I am extremely new to both Ruby and Rails and have no idea how to fix this. I have seen other stackoverflow pages with similar questions but none have been able to help me. I recently upgraded to Mountain Lion and was told that could be an issue. I was told to use RVM to uninstall and then reinstall Ruby. I tried that and it did not work.

Please help. Thank you.


Solution

  • Try removing ,'3.0.1' or try like this gem "bcrypt", "~> 3.1.1"

    Hope it helps.

    If not, from console try running gem install bcrypt