Mac OS X Mountain Lion“该系统上当前未安装Rails". [英] Mac OS X Mountain Lion "Rails is not currently installed on this system."
问题描述
我正在全新安装OS X Mountain Lion.我已经通过以下方式安装了滑轨:
I am on a fresh install of OS X Mountain Lion. I have installed rails via:
sudo gem install rails
一切似乎都正确安装,但是当我键入rails命令(rails s,rails -v等)时,出现此错误:
Everything seems to install correctly, but when I type the rails command (rails s, rails -v, etc), I get this error:
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.
"which rails
"的结果为/usr/bin/rails
我以为这是路径问题,也许是,但是我可以看到/usr/bin是我的PATH的一部分.
I thought it was a path issue, and perhaps it is, but I can see that /usr/bin is part of my PATH.
有帮助吗?谢谢!
更新:我注意到其他Mac上具有相同操作系统的所有设备都运行良好……我只是不记得自己是如何工作的.如果我运行哪个轨道",我会发现它位于完全不同的位置/Users/username/.rvm/gems/ruby-1.9.3-p194/bin/rails
UPDATE: I noticed everything on my other mac with same exact OS works pretty well... I just can't remember how I got it to work that way. If I run 'which rails' I see it's in a totally different place /Users/username/.rvm/gems/ruby-1.9.3-p194/bin/rails
推荐答案
使用RVM http://rvm.io 或rbenv安装更新的Rails版本,而不是OS X预先安装的版本.
Use RVM http://rvm.io or rbenv to install newer Rails versions than what come pre-installed with OS X.
遵循网站上的示例 https://rvm.io/rvm/install/,但基本上:
Follow examples on the site https://rvm.io/rvm/install/ but basically:
安装RVM:$ \curl -L https://get.rvm.io | bash -s stable
然后您可以$$ c3>来查看可用的红宝石(手数).只需$ rvm install 1.9.3
即可获取最新版本的Ruby(在撰写本文时为ruby-1.9.3-p327
)
You can then $rvm list known
to see what Rubies are available to you (lots). And simply $rvm install 1.9.3
to get the most current version of Ruby (which as of this writing is ruby-1.9.3-p327
)
将该红宝石设置为默认的$ rvm --default use 1.9.3
Set that ruby as your default $rvm --default use 1.9.3
创建一个默认的宝石集来存储您的宝石$ rvm use 1.9.3@mygemset --create --default
Create a default gemset to store your gems $rvm use 1.9.3@mygemset --create --default
然后安装Rails $ gem install rails
将使您获得最新信息,今天与键入gem install rails -v 3.2.9
Then install Rails $ gem install rails
will get you current which today is same as typing gem install rails -v 3.2.9
这篇关于Mac OS X Mountain Lion“该系统上当前未安装Rails".的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!