[英]Error installing Rails on Macbook Air OS 10.9
I have been trying to install rails on my Macbook Air running OSX 10.9, but I keep running into errors. 我一直在尝试在运行OSX 10.9的Macbook Air上安装rails,但我一直遇到错误。
When I type 当我输入
$ gem -v $ gem -v
I get 我明白了
2.0.3 2.0.3
and 和
$ rails -v $ rails -v
yields 产量
Rails is not currently installed on this system. 当前未在此系统上安装Rails。 To get the latest version, simply type: 要获取最新版本,只需键入:
$ sudo gem install rails $ sudo gem install rails
You can then rerun your "rails" command. 然后,您可以重新运行“rails”命令。
When I type 当我输入
$ gem install rails $ gem install rails
I get 我明白了
Fetching: i18n-0.6.9.gem (100%) 取出:i18n-0.6.9.gem(100%)
ERROR: While executing gem ... (Gem::FilePermissionError) 错误:执行gem时...(Gem :: FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory. 您没有/Library/Ruby/Gems/2.0.0目录的写权限。
So I type 所以我输入
$ sudo gem install rails $ sudo gem install rails
I put in my password and I get 我输入了密码然后收到了
Fetching: i18n-0.6.9.gem (100%) 取出:i18n-0.6.9.gem(100%)
Successfully installed i18n-0.6.9 成功安装了i18n-0.6.9
Fetching: multi_json-1.8.2.gem (100%) 获取:multi_json-1.8.2.gem(100%)
Successfully installed multi_json-1.8.2 已成功安装multi_json-1.8.2
Fetching: tzinfo-0.3.38.gem (100%) 获取:tzinfo-0.3.38.gem(100%)
Successfully installed tzinfo-0.3.38 成功安装了tzinfo-0.3.38
Fetching: minitest-4.7.5.gem (100%) 取出:minitest-4.7.5.gem(100%)
Successfully installed minitest-4.7.5 成功安装了minitest-4.7.5
Fetching: atomic-1.1.14.gem (100%) 获取:atomic-1.1.14.gem(100%)
Building native extensions. 构建原生扩展。 This could take a while... 这可能需要一段时间......
ERROR: Error installing rails: 错误:安装rails时出错:
ERROR: Failed to build gem native extension. 错误:无法构建gem原生扩展。
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb
mkmf.rb can't find header files for ruby at mkmf.rb无法找到ruby的头文件
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/include/ruby.h /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/include/ruby.h
and then I don't know what to do... 然后我不知道该怎么办......
I had this same problem on my MacBook Pro. 我在MacBook Pro上遇到了同样的问题。 You'll want to use a ruby version manager. 你会想要使用ruby版本管理器。
The reason a ruby manager will solve this problem is because the tool is installed into a path that is write-accessible to you — thus you will not get permission denied
errors when installing. ruby管理器解决此问题的原因是因为该工具安装在可写入的路径中 - 因此安装时不会获得permission denied
错误。
homebrew
: http://brew.sh/ 如果你还没有,你需要安装homebrew
: http : //brew.sh/ then install either: 然后安装:
brew install rbenv.
or 要么
brew install rvm
Personally, I use rbenv
, but either works well under OS X. 就个人而言,我使用rbenv
,但在OS X下运行良好。
After you have either rvm
or rbenv
installed and working, install your gem as usual. 安装了rvm
或rbenv
并正常工作后,像往常一样安装gem。
I followed the steps in the blog post below and I finally got rails working on my 2012 MacBook Air running Maverick(10.9.4). 我按照下面博客文章中的步骤进行操作,最后我在2012年MacBook Air上运行Maverick(10.9.4)。
http://www.createdbypete.com/articles/ruby-on-rails-development-setup-for-mac-osx/ http://www.createdbypete.com/articles/ruby-on-rails-development-setup-for-mac-osx/
Though probably overkill, I reloaded Terminal after I entered each line. 虽然可能有点过分,但在我进入每一行之后我重新加载了终端。
Now when I type: 现在当我输入:
$gem -v
I get 我明白了
2.0.3
and if I type 如果我打字
$ruby -v
I get 我明白了
ruby 2.0.0p451 (2014-02-24 revision 45167) [universal.x86_64-darwin13]
And finally, when I type 最后,当我输入
$rails -v
I get 我明白了
Rails 4.1.4
:) :)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.