Ruby 1.8.7, checkinstall and gem

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.

···

--
Posted via http://www.ruby-forum.com/.

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

or log out and log back in.

···

On Nov 1, 2010, at 12:19 , James Byrne wrote:

$ 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

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.

···

--
Posted via http://www.ruby-forum.com/\.