简体   繁体   中英

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. Before this, I had 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. You'll see what I mean in a sec.

Theoretically, I've got the latest versions of 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 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 -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?

What does which gem return?

Probably, your Ruby installation points to /opt/local/bin/ while the gem command is still referencing /usr/bin/ . When you installed the Gem, the Gem was saved in /usr/bin/ and loads the original system 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 .

Try executing this command /opt/local/bin/ruby -v from the command line and see what version of ruby that come out.

Next find out where is the ruby gems is located with whereis ruby . I assume it should near /opt/local/lib/ruby-xx/gems/... . Also try find out whether rails is installed under those directories. If not, your rails might be still pointing to the old ruby.

Also check if you have /usr/bin/ruby? If so, what is the output of /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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM