views:

311

answers:

2

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?

+1  A: 

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-x.x/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

jpartogi
$ /opt/local/bin/ruby -v ... yields ... ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin9] ... $ whereis ruby ... yields ... /usr/bin/rubySo, if I'm understanding your point, both Ruby 1.8.7 and Rails 3 (and RubyGems 1.3.5) should all be in the same directory?
charliepark
I suspect so. Do you have `/usr/bin/ruby` ? If so, what is the output of `/usr/bin/ruby -v` ?
jpartogi
Ah. This output: ruby 1.8.6 (2008-08-11 patchlevel 287) [universal-darwin9.0] ... a friend suggested I remove Rails and then try to reinstall it, with the idea being that then reinstalling it would hopefully put Rails in opt/local/bin. Is removing the system version of Rails problematic?
charliepark
So you should uninstall that ruby and rails, and install the `rails gem` all over again with `/opt/local/bin/ruby`. Cheers.
jpartogi
I thought I had it, but I'm hitting a new problem.I can create a new rails app, but if I try to run script/server, I get a strange message: ... applications $ cd testapp05 ... testapp05 $ script/server ... /Users/Park/.gem/ruby/1.8/gems/mongrel-1.1.5/lib/http11.bundle: [BUG] Bus Error ... ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-darwin9] ... Abort trap ... testapp05 $ script/server ... Any idea what that's referring to? I've never seen a "Bus Error" before. (???)
charliepark
The error is from your mongrel. Try uninstalling mongrel gem and live with webrick for the time being.
jpartogi
This remedied the issue, although I soon ran into some others, so I ended up going with RVM, using the tutorial here: http://pivotallabs.com/users/jsusser/blog/articles/1173-spiking-on-a-rails-3-upgrade.
charliepark
+3  A: 

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.

Simone Carletti
$ which gem /opt/local/bin/gemI might go ahead and try RVM. I know Ryan Bates was endorsing it in his latest Railscast. (I'm sorry if this is a dumb question: How do I remove all of my ruby versions? Just delete the folders?)
charliepark
Simone, thanks for that initial recommendation to go with RVM. I used the tutorial here: http://pivotallabs.com/users/jsusser/blog/articles/1173-spiking-on-a-rails-3-upgrade">this tutorial ... and it seems to be working. We'll see how it goes.
charliepark