为什么我在Mac OS Lion上出现此错误?

时间:2012-05-19 07:56:53

标签: ruby-on-rails ruby

我不知道发生了什么但我下载了Xcode for OS lion而且我被困了

Building native extensions.  This could take a while...
ERROR:  Error installing rails:
    ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h


Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/json-1.7.3 for inspection.
Results logged to /Library/Ruby/Gems/1.8/gems/json-1.7.3/ext/json/ext/parser/gem_make.out
Jung-Hyun-Jeons-MacBook-Pro:~ peterjeon$ rails -v
Rails is not currently installed on this system. To get the latest version, simply type:

$ sudo gem install rails

You can then rerun your "rails" command.

1 个答案:

答案 0 :(得分:1)

我建议使用Ruby版本管理器的RVM。并使用Ruby的最新版本。

使用以下单个命令行安装RVM:

curl https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer | bash -s stable

不要将其安装为root(以避免出现问题),除非您知道自己在做什么。

安装完成后,安装Ruby:rvm install 1.9.3

然后使用您安装的版本作为默认版本:rvm use 1.9.3 --default (如果不使用--default前缀,则每次要使用Ruby时都必须运行该命令。

希望它有所帮助,祝你好运!