问题描述
我在尝试使用 RVM 在 OS X Lion 上安装 Rails 时遇到问题.
I'm running into issues trying to install Rails on OS X Lion using RVM.
到目前为止,我已经完成了以下工作:
So far, I have done the following:
- 已安装 Mac OS X Lion 版本 10.7(内部版本 11A459e).
- 已安装 XCode 4.1 Developer Preview 5.
- 已安装 RVM.
- 使用命令
rvm install 1.8.7
通过 RVM 安装了 1.8.7 版本的 Ruby.注意:我需要使用 1.8.7 而不是 1.9.2. - 使用命令
rvm 1.8.7
切换到 1.8.7 版本的 Ruby. - 使用命令
rvm gemset create rails3
创建了一个新的 gemset. - 使用命令
rvm use 1.8.7@rails3
切换到新的 gemset. 要安装 Rails,我运行了命令
gem install rails
,但出现以下错误:
- Installed Mac OS X Lion Version 10.7 (Build 11A459e).
- Installed XCode 4.1 Developer Preview 5.
- Installed RVM.
- 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. - Switched to the 1.8.7 version of Ruby using the command
rvm 1.8.7
. - Created a new gemset using the command
rvm gemset create rails3
. - Switched to the new gemset using the command
rvm use 1.8.7@rails3
. 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] 分段错误
/Users/m/.rvm/rubies/ruby-1.8.7-p334/lib/ruby/1.8/timeout.rb:60: [BUG] Segmentation fault
尝试运行任何 gem 命令时都会发生同样的错误,所以我认为这不是 Rails 的真正问题.
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和 https://github.com/carlhuda/bundler/issues/1058
推荐答案
已修复!
答案实际上是在我上面发布的链接之一上.在安装 ruby 版本(rvm install 1.8.7)之前,我需要运行export CC=/usr/bin/gcc-4.2
".有了这个,一切都顺利进行.
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.
如果不想永久导出CC
,可以做CC=/usr/bin/gcc-4.2 rvm install 1.8.7
If you don't want to have CC
permanently exported, you can do CC=/usr/bin/gcc-4.2 rvm install 1.8.7
如果您已经安装了 ruby 1.8.7.只需执行 CC=/usr/bin/gcc-4.2 rvm 重新安装 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
这篇关于为什么我不能使用 RVM 在 Lion 上安装 Rails?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!