Ruby Forum Ruby on Rails > error: Rails requires RubyGems >= . Please install RubyGems

Posted by David Kleman (davve)
on 21.12.2008 18:50
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?
Posted by Frederick Cheung (Guest)
on 21.12.2008 18:52
(Received via mailing list)
On 21 Dec 2008, at 17:50, David Kleman wrote:

>
> 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
Posted by Merrick Johnson (merrick)
on 21.12.2008 23:47
did you check your $PATH ? sounds like its calling the wrong executables
Posted by David Kleman (davve)
on 22.12.2008 00:05
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.
Posted by Jonathan (Guest)
on 25.01.2009 17:28
(Received via mailing list)
On Dec 22 2008, 8:05 am, David Kleman <rails-mailing-l...@andreas-
s.net> wrote:
> 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:)

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.
Posted by Km Hui (kmhui)
on 03.05.2009 01:03
David Kleman wrote:
> 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.

Could you provide the steps too? Am facing the same problem.

thanks,
--kmhui
Posted by jeff leeman (Guest)
on 03.06.2009 20:53
(Received via mailing list)
Yea I'm having the exact same problem.  Can someone provide more
detail on how to solve this?

Thanks,
Jeff
Posted by David (Guest)
on 13.06.2009 10:34
(Received via mailing list)
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.
Posted by Memo Memo (memo_salas)
on 06.11.2009 08:55
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.
Posted by Derek Lei (dlei)
on 18.07.2010 01:30
I had the same problem, and reason is also having two versions of ruby 
installed. i working on OSX 10.6.4, but solution should apply for any 
system if your problem has the same cause. Since I don't really use 
macport, my solution is to removed reference to /opt/usr/local/bin from 
my $PATH in ~/.bashrc. so in the end, i have the following line in my 
~/.bashrc (removed some other misc stuff, but you get the idea):

export PATH="/usr/local/bin:/usr/local/lib:$PATH"

I suspect you'll be able to fix it by tweaking where you get your binary 
in $PATH as well. hope this helps.

btw, I think David had to reinstall stuff because the location where he 
pointed $PATH to doesn't have all the executables in the other location 
he was running gem from.

Derek

Memo Memo wrote:
> 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.