Rails requires RubyGems >= 1.1.1 : problem

Hello,

On my local machine (Mac OS X 10.5.5), I get the following error when I try to run script/server start :

“Rails requires RubyGems >= 1.1.1 (you have 1.0.1). Please gem update --system and try again.”

The Rails app was a former 1.2.6 upgraded to 2.1, and it worked fine.

I’ve run the rake rails:update command.

If I create a new Rails app, it starts with the command script/server start without complaining.

I’ve run :

sudo gem update --system

Updating RubyGems

Nothing to update

Some infos :

  • gem -v

1.3.1

  • which gem

/usr/local/bin/gem

  • ruby -v

ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-darwin9.5.1]

  • which ruby

/usr/local/bin/ruby

  • rails -v

Rails 2.1.2

  • which rails

/usr/local/bin/rails

  • gem list

*** LOCAL GEMS ***

actionmailer (2.1.2, 2.1.0, 1.3.6)

actionpack (2.1.2, 2.1.0, 1.13.6)

actionwebservice (1.2.6)

activerecord (2.1.2, 2.1.0, 1.15.6)

activeresource (2.1.2, 2.1.0)

activesupport (2.1.2, 2.1.0, 1.4.4)

capistrano (2.5.0)

cgi_multipart_eof_fix (2.5.0)

daemons (1.0.10)

fastthread (1.0.1)

gem_plugin (0.2.3)

highline (1.4.0)

mongrel (1.1.5)

mysql (2.7)

net-scp (1.0.1)

net-sftp (2.0.1)

net-ssh (2.0.4)

net-ssh-gateway (1.0.0)

rails (2.1.2, 2.1.0, 1.2.6)

rake (0.8.3)

rubygems-update (1.3.1)

Any idea?

Thanks in advance for your help.

Best,

Thomas.

Check the file config/environment.rb in your application's directory tree. It will have a line like:

RAILS_GEM_VERSION = '2.2.0' unless defined? RAILS_GEM_VERSION

Change the RAILS_GEM_VERSION to match yours, 2.1.2, and restart your script/server.

Rick

Just a wild guess but you have installed the ports version of ruby 1.8.7 which is not the default ruby install on osx. Gems are installed and stored under the ruby install that it was installed with.. Which means if you installed all the gems in one ruby then added the ports ruby you need to reinstall your gems...

You script/server might be getting some old path info... ?? I know when I upgraded to 1.8.7 on the mac I had very similar issues...

Hello Rick,

Thanks for your help.

I already have this line in my environment.conf “RAILS_GEM_VERSION = ‘2.1.2’ unless defined? RAILS_GEM_VERSION”.

But I still get the same “Rails requires RubyGems >= 1.1.1 (you have 1.0.1). Please gem update --system and try again.” error.

Thomas.

Hello Freddy,

Thanks for your guess, but I compiled ruby manually, following Dan Benjamin’s instructions found here :

http://danbenjamin.com/articles/2008/02/ruby-rails-leopard

Thomas.

ok,

So the "Rails requires..." message is comming from ".../gems/1.8/gems/ rails-2.1.2/environments/boot.rb" which will also force a load from "vendor/rails" if you have one.

Did you freeze rails into your app by any chance?

Rick

Hello Rick,

My app wasn’t frozen.

I froze it to 2.1.2 and script/server start now works.

Thanks for your help.

Still, I don’t understand why it didn’t worked without the freeze.

Best,

Thomas.

Excuse me. I'm caught in a similar problem. thank you for the hints so far.

But symptom at my hands has a great difference to Balthazar-san's one; "gem -v" returns 1.1.0, and it sticks whatever I've done(have downloaded rubygems-1.3.1 and let steup.rb run).

I froze it to 2.1.2 and script/server start now works.

So I don't get success in freezing: the same error message comes up! when try freezing.

Won't you please give some further hints? I guess "gem -v" should be to return 1.3.1 somehow...

Hello,

Did you try to run ‘gem update --system’?

Which OS are you running?

Best,

Thomas.

HI

Did you try to run 'gem update --system'?

Of Course I did. and got "nothing to update".

Which OS are you running?

Mac OS X 10.5.5 as yours (^_^;) I wonder ones with other platforms haven't come across the problem...

Best.

I guess "gem -v" should be to return 1.3.1 somehow...

At last I found http://docs.rubygems.org/read/chapter/15#page101 tells "GEM_HOME should point to $PREFIX/lib/ruby/gems/1.8 if it used with the 1.8 version of ruby." and that kind of settings now makes all OK. "gem -v" now returns 1.3.1 and script/server starts WEBrick.

I used to use /usr/local/rubygems/ of gem install dir, according to the default setting of gem (of former version). I damn that setting! I also find the default is now /usr/local/lib/ruby/gems/1.8 under gem of v1.3.1.

moto@Yonago, Japan

$ gem install rubygems-update $ update_rubygems