[英]Trying to install Rails 3, getting a strange “Ruby upgrade” notice
I'm trying to get my computer (Mac OS X, running Leopard) running with the latest version of Rails. 我正在尝试使我的计算机(Mac OS X,运行Leopard)运行最新版本的Rails。 Before this, I had 2.3.5.
在此之前,我有2.3.5。 I tried following some instructions a few days ago, but didn't seem to make much progress.
几天前,我尝试按照一些说明进行操作,但似乎并没有取得太大进展。 Now, I can't do anything in Rails.
现在,我无法在Rails中做任何事情 。 You'll see what I mean in a sec.
几秒钟后您就会明白我的意思。
Theoretically, I've got the latest versions of Ruby: 从理论上讲,我拥有最新版本的Ruby:
$ ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin9]
$ sudo ruby -v
Password:
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin9]
But if I try to run Rails, I get this error message: 但是,如果我尝试运行Rails,则会收到以下错误消息:
$ rails testapp03
Rails requires Ruby version 1.8.7 or later.
You're running 1.8.6 (2008-08-11); please upgrade to continue.
And if I try to see which version of Rails I'm using, I get the same: 如果我尝试查看使用的是哪个版本的Rails,我会得到相同的结果:
$ rails -v
Rails requires Ruby version 1.8.7 or later.
You're running 1.8.6 (2008-08-11); please upgrade to continue.
In case these are useful: 如果这些是有用的:
$ which ruby
/opt/local/bin/ruby
$ sudo which ruby
Password:
/opt/local/bin/ruby
$ which rails
/usr/bin/rails
So, the question: What have I done, and what do I need to do to get Ruby / RubyGems / Rails up and running on my computer? 那么,问题就来了: 我该怎么做,并且要在我的计算机上启动并运行Ruby / RubyGems / Rails,我需要做什么?
What does which gem
return? which gem
返回什么?
Probably, your Ruby installation points to /opt/local/bin/
while the gem command is still referencing /usr/bin/
. 可能您的Ruby安装指向
/opt/local/bin/
而gem命令仍引用/usr/bin/
。 When you installed the Gem, the Gem was saved in /usr/bin/
and loads the original system Ruby. 当您安装Gem时,该Gem被保存在
/usr/bin/
并加载原始系统Ruby。
I don't know how you installed Ruby 1.8.7, however I would suggest you to take a step further: remove all your Ruby versions (except the system one, of course) and try RVM . 我不知道您是如何安装Ruby 1.8.7的,但是我建议您更进一步:删除所有Ruby版本(当然,系统版本除外)并尝试RVM 。
Try executing this command /opt/local/bin/ruby -v
from the command line and see what version of ruby that come out. 尝试从命令行执行此命令
/opt/local/bin/ruby -v
,看看会出现什么版本的ruby。
Next find out where is the ruby gems is located with whereis ruby
. 接下来找出红宝石所在的宝石和
whereis ruby
。 I assume it should near /opt/local/lib/ruby-xx/gems/...
. 我认为它应该在
/opt/local/lib/ruby-xx/gems/...
。 Also try find out whether rails is installed under those directories. 也尝试找出这些目录下是否安装了rails。 If not, your rails might be still pointing to the old ruby.
如果没有,您的轨道可能仍指向旧的红宝石。
Also check if you have /usr/bin/ruby? 还检查您是否有/ usr / bin / ruby? If so, what is the output of /usr/bin/ruby -v ?
如果是这样,/ usr / bin / ruby -v的输出是什么? If it exists and rails is pointing to that version, So you should uninstall that ruby and rails, and install the rails gem all over again with /opt/local/bin/ruby
如果存在并且rails指向该版本,那么您应该卸载该ruby和rails,然后使用/ opt / local / bin / ruby重新安装rails gem
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.