无法在我的全新Mac OS X Lion 10.7.3上安装rails

时间:2012-04-17 13:23:13

标签: ruby-on-rails ruby ruby-on-rails-3 macos rubygems

刚买了一个新的macbook pro,我遇到安装导轨的麻烦.. 我已经安装了ruby 1.8.7,当我尝试编写'gem install rails'时,我得到:

ERROR:  While executing gem ... (Gem::FilePermissionError)
You don't have write permissions into the /Library/Ruby/Gems/1.8 directory.

我还尝试安装更高版本的ruby,它说:

    Nirs-MacBook-Pro:~ nirohayon$ rvm install 1.9.3
Fetching yaml-0.1.4.tar.gz to /Users/nirohayon/.rvm/archives
Extracting yaml-0.1.4.tar.gz to /Users/nirohayon/.rvm/src
Configuring yaml in /Users/nirohayon/.rvm/src/yaml-0.1.4.
Error running ' ./configure --prefix="/Users/nirohayon/.rvm/usr"  ', please read /Users/nirohayon/.rvm/log/ruby-1.9.3-p125/yaml/configure.log
Compiling yaml in /Users/nirohayon/.rvm/src/yaml-0.1.4.
Error running 'make ', please read /Users/nirohayon/.rvm/log/ruby-1.9.3-p125/yaml/make.log


Database file /Users/nirohayon/.rvm/config/packages does not exist.

Installing Ruby from source to: /Users/nirohayon/.rvm/rubies/ruby-1.9.3-p125, this may take a while depending on your cpu(s)...

ruby-1.9.3-p125 - #fetching 
ruby-1.9.3-p125 - #extracted to /Users/nirohayon/.rvm/src/ruby-1.9.3-p125 (already extracted)
ruby-1.9.3-p125 - #configuring 
Error running ' ./configure --prefix=/Users/nirohayon/.rvm/rubies/ruby-1.9.3-p125 --enable-shared --disable-install-doc --with-libyaml --with-opt-dir=/Users/nirohayon/.rvm/usr ', please read /Users/nirohayon/.rvm/log/ruby-1.9.3-p125/configure.log
There has been an error while running configure. Halting the installation.
ls: /Users/nirohayon/.rvm/rubies/*/bin/ruby: No such file or directory

请帮助我,我之前使用的是windows,也是rails的新手,所以我不太了解我应该指向哪个路径终端。我需要一步一步的解释,把铁轨放在我的Mac上。

非常感谢! 尼尔

2 个答案:

答案 0 :(得分:1)

您对RVM的使用看起来很像您没有安装开发人员工具。从App Store中获取XCode,安装命令行工具!

如果你真的想在平台提供的ruby上安装rails,你需要做的就是sudo gem install rails,因为你需要使用管理员权限来处理系统gemset中的gent。

答案 1 :(得分:1)

This tutorial帮助我在使用OS X 10.6之前在mac上安装(我相信)。唯一出现问题的是C编译器,我发现这是查找其中一个错误的问题。

通过输入Error running 'make ', please read /Users/nirohayon/.rvm/log/ruby-1.9.3-p125/yaml/make.log类型vi /Users/nirohayon/.rvm/log/ruby-1.9.3-p125/yaml/make.log键,然后输入esc退出来查找输出:q!,您可能会找到。

如前所述,您需要获得编译器。我不知道Xcode的具体细节,但是我在Github上找到了Mac上GCC编译器的安装程序我相信但是它可能更好直接来自Apple软件包,(tutorial here

另请注意,如果您最终不得不使用sudo,那么您可能已经偏离了指南,无法在系统上安装RVM。在这种情况下,您的路径将位于主目录以外的某个位置,并且使用echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"' >> ~/.bash_profile调整源的说明将不起作用。这可能最终会出现在"/usr/local/rvm/scripts/rvm"

之类的地方