Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.2k views
in Technique[技术] by (71.8m points)

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

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

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to WuJiGu Developer Q&A Community for programmer and developer-Open, Learning and Share
...