error: Rails requires RubyGems >= . Please install RubyGems

In the directory of my rails app i run:

ruby script/console

Rails requires RubyGems >= . Please install RubyGems and try again: http://rubygems.rubyforge.org

gem -v 1.3.1

gem list | grep rails rails (2.2.2, 2.1.2)

gem list | grep rubygems rubygems-update (1.3.1)

gem environment RubyGems Environment:   - RUBYGEMS VERSION: 1.3.1   - RUBY VERSION: 1.8.4 (2005-12-24) [i586-linux]   - INSTALLATION DIRECTORY: /usr/lib/ruby/gems/1.8   - RUBY EXECUTABLE: /usr/bin/ruby   - EXECUTABLE DIRECTORY: /usr/bin   - RUBYGEMS PLATFORMS:     - ruby     - x86-linux   - GEM PATHS:      - /usr/lib/ruby/gems/1.8      - /root/.gem/ruby/1.8    ...

ruby --version ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-linux]

There is a mismatch between the Ruby version returned by 'gem environment' and ruby --version Anyone know if this is normal? I don't really know if this is causing the problem

Other ideas?

ruby --version ruby 1.8.7 (2008-08-11 patchlevel 72) [i686-linux]

There is a mismatch between the Ruby version returned by 'gem environment' and ruby --version Anyone know if this is normal? I don't really know if this is causing the problem

It probably is. I'd guess you have two parallel versions of ruby (one
in /usr/lib/ruby, the other probably in /usr/local/lib/ruby). One of
those has rubygems 1.3.1 installed, the other doesn't and you're
trying to run rails in the one that doesn't

Fred

Merrick Johnson wrote:

did you check your $PATH ? sounds like its calling the wrong executables

You're both right. There was two conflicting versions installed. Fixing this led to some a chain of reinstallations but it's now fine and I also got to learn a bunch of new gem commands:)

Thanks for your help in making me realising what the problem was.

I'm getting the exact same error and can confirm I have the same problem (multiple versions of ruby and rubygems installed). Could you detail how you went about this "chain of reinstallations" to fix this problem? I'm still quite new to all this. FYI, I'm using Mac OS X 10.5.6.

Yea I'm having the exact same problem. Can someone provide more detail on how to solve this?

Thanks, Jeff

I had installed ruby 1.8.7 from MacPorts and was also getting this error. After downloading RubyGems and running setup.rb, things worked as expected. I, of course, had to reinstall my gems since the new RubyGems (/opt/local/bin/gem) keeps its gems in a different spot than the gem that comes with Leopard (/usr/bin/gem).

All this is a little new to me but this is how I got it to work.

I was having this problem, after reading the insights from this thread, I realised running "which gem" pointed to a certain directory, and "which ruby" pointed to a different directory.

I had a local ruby installation, and also a secondary installation under /sw that I had installed using fink, I just plain removed the installation fink had put in (fink remove ruby), and after that everything worked.