Why can't I install Rails on Lion using RVM?

Michael Jerome picture Michael Jerome · May 30, 2011 · Viewed 28.4k times · Source

I'm running into issues trying to install Rails on OS X Lion using RVM.

So far, I have done the following:

  1. Installed Mac OS X Lion Version 10.7 (Build 11A459e).
  2. Installed XCode 4.1 Developer Preview 5.
  3. Installed RVM.
  4. Installed a 1.8.7 version of Ruby via RVM using the command rvm install 1.8.7. Note: I need to be using 1.8.7 and not 1.9.2.
  5. Switched to the 1.8.7 version of Ruby using the command rvm 1.8.7.
  6. Created a new gemset using the command rvm gemset create rails3.
  7. Switched to the new gemset using the command rvm use 1.8.7@rails3.
  8. To install Rails I ran the command gem install rails but I got the following error:

    /Users/m/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/timeout.rb:60: [BUG] Segmentation fault

The same error happens when trying to run any gem command so I don't think it's really a problem with Rails.

Judging by the links below, I don't seem to be the only person having this issue:

http://twitter.com/#!/pingles/status/66261101351927809 and https://github.com/carlhuda/bundler/issues/1058

Answer

Michael Jerome picture Michael Jerome · May 30, 2011

Fixed it!

The answer was actually on one of the links I posted above. Before installing a version of ruby (rvm install 1.8.7) I needed to run "export CC=/usr/bin/gcc-4.2". With that in place, everything ran smoothly.

If you don't want to have CC permanently exported, you can do CC=/usr/bin/gcc-4.2 rvm install 1.8.7

If you have already installed ruby 1.8.7. Just do CC=/usr/bin/gcc-4.2 rvm reinstall 1.8.7