views:

271

answers:

3

I'm running Tiger and (stupidly) decided to upgrade Rails from 1.1.6 to 1.2.6. I ran the command "sudo gem install rails --include-dependencies" and everything seemed to go OK. However, after the install, when I ran the command "rails -v", I got the errors shown below. Could it be that 1.2.6 is not compatible with Tiger? I've been searching the Internet for compatibility info but haven't found anything. By the way, in desperation, I tried to go back to 1.1.6 but I still get the same errors so now I'm hosed. Can anyone help? Thanks.

/usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support/dependencies.rb:55: uninitialized constant ActiveSupport::Dependencies::Mutex (NameError)
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
    from /usr/local/lib/ruby/gems/1.8/gems/activesupport-2.3.2/lib/active_support.rb:56
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
    from /usr/local/lib/ruby/gems/1.8/gems/activerecord-2.3.2/lib/active_record.rb:25
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `gem_original_require'
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in `require'
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:229:in `activate'
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:228:in `each'
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:228:in `activate'
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:214:in `activate'
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:213:in `each'
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:213:in `activate'
    from /usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:66:in `active_gem_with_options'
    from /usr/local/lib/ruby/site
+3  A: 

By what you did, it looks like you jumped right to rails 2.3.2.

What I'd advise you to do now is to first upgrade everything:

sudo gem update --system
sudo gem update

And then install the 1.2.6 version too. Now you'll have 1.1.6, 1.2.6 and 2.3.2

sudo gem install rails -v1.2.6

And, btw, what's your ruby version, and are you using the one supplied by Apple? Particularly, if you ran the two following commands you'd get the information you need. (which will certainly differ from mine)

$ ruby --version
ruby 1.8.7 (2009-04-08 patchlevel 160) [i686-darwin9]
$ which ruby
/opt/local/bin/ruby

And no, there's no incompatibility with Tiger.

kch
Thanks kch, I seem to be back in business and I'm now running Rails 2.3.2 (and Ruby 1.8.5). Two more questions if you don't mind. One, where are these three different versions of Rails stored? The rails file in /usr/local/bin is just a script file. Two, when I create an application, how do I specify which version of Rails I want to be running? Thanks again. I really appreciate your help. Hopefully I'll be experienced enough one day that I can return the favor to other "newbies."
Mine are in /opt/local/lib/ruby/gems/1.8/gems, but it depends on where your ruby is. Eg. for the standard OS X version, they're at /usr/lib/ruby/gems/1.8/gems.
kch
As for how to choose which rails version to use when running the rails command, I don't know. You can, however, once you have the app, set the desired gem version in environment.rb or put the desired rails version in vendor. An entire new SO question would be better for this one.
kch
I was just reading that you can specify the version you want by surrounding the version number with underscores when you create the project: rails _1.2.6_ myprojectI haven't had a chance to try it but that's what I read. Thanks again!
A: 

I got this error when I was (blindly) following the OS X RoR install directions from HiveLogic. You'd expect they'd be OK because Apple links to them. HOWEVER, the binary paths includes in this document are out of date!!!

Specially, the RubyGems were 0.9 instead of 1.3. Other binaries in the list were out of date with dead links.

To fix the problem, follow the current directions from Ruby on Rails. You'll download and install the right version of RubyGems and be good to go!

If you followed the HiveLogic directions, you may want to check ALL your versions.

RAVolt
A: 

You specify your desired Gem version by setting the RAILS_GEM_VERSION constant at the top of config/environment.rb, e.g.

RAILS_GEM_VERSION = '2.3.2'

OR you can freeze Rails in vendor/rails. When Rails bootstraps itself from your app it will first look in vendor/rails, so you can freeze your desired version in there. But I prefer the RAILS_GEM_VERSION approach myself.

Cody Caughlan