Ruby 1.8.7, checkinstall and gem

J

James Byrne

OS = CentOS-5.5

In order to support Rails3 I am required to upgrade the Ruby
installation from the distribution's own 1.8.6 package to 1.8.7. I
therefore downloaded and built 1.8.7.p302 and used checkinstall to
package
it as an rpm. I then used yum localinstall to upgrade.

This has all gone well, as far as I can determine, but I cannot get the
gem command to find the new ruby.

$ which ruby
/usr/local/bin/ruby
$ ruby -v
ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-linux]
$ which gem
/usr/local/bin/gem
$ ll /usr/local/bin/gem
-rwxr-xr-x 1 root root 548 Nov 1 15:03 /usr/local/bin/gem
$ gem environment
-bash: /usr/bin/gem: No such file or directory

So, why does typing gem look for user/bin/gem instead of finding
/usr/local/bib/gem? Clearly, since the which command found it, the
paths are searched and the new gem executable is located. Where is gem
= /usr/bin/gem coming from? How to I fix this, short of soft linking
/usr/local/bin/gem to /usr/bin/gem.
 
R

Ryan Davis

$ which ruby
/usr/local/bin/ruby
$ ruby -v
ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-linux]
$ which gem
/usr/local/bin/gem
$ ll /usr/local/bin/gem
-rwxr-xr-x 1 root root 548 Nov 1 15:03 /usr/local/bin/gem
$ gem environment
-bash: /usr/bin/gem: No such file or directory

Usually this means that your shell cached the old location and can be =
reset with `hash -r`.

or log out and log back in.
 
J

James Byrne

Ryan Davis wrote in post #958573:
Usually this means that your shell cached the old location and can be
reset with `hash -r`.

Thank you very much. That was exactly the problem and the solution. I
have never before encountered the hash command. You learn something new
every day.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,968
Messages
2,570,154
Members
46,702
Latest member
LukasConde

Latest Threads

Top