views:

630

answers:

2

Everything was working fine , until we decided to upgrade ruby to 1.8.7 from 1.8.6, and thats when all hell broke loose. When we compiled Ruby 1.8.7 from source it got installed into /usr/local/bin and Ruby 1.8.6 stayed in /usr/bin. Currently, we've uninstalled ruby 1.8.6 and by some stroke we deleted the ruby 1.8.7 files from /usr/local.

when we try "which ruby" it points to /usr/local. If anybody could help us out what we need to do get back on track , we would be very grateful.and also any idea how we can uninstall ruby from /usr/local. we tried yum remove ruby , which removed ruby from /usr/bin.Thanks and Cheers !

A: 

Create a symlink at /usr/bin named 'ruby' and point it to the latest installed ruby.

You can use something like ln -s /usr/bin/ruby /to/the/installed/ruby/binary

Hope this helps.

intellidiot
Did you mean /etc/bin/ruby or /usr/bin/ruby? Also, there are additional ruby-related names that need to be linked such as irb, rdoc, etc.
Greg
Greg,my bad... You pointed it correctly, it's /usr/bin/ruby, just like the first line. I'll correct it. Thanks :-)
intellidiot
A: 

It's not a good idea to uninstall 1.8.6 if it's in /usr/bin. That is owned by the OS and is expected to be there.

If you put /usr/local/bin in your PATH before /usr/bin then things you have installed in /usr/local/bin will be found before any with the same name in /usr/bin, effectively overwriting or updating them, without actually doing so. You can still reach them by explicitely using /usr/bin in your #! interpreter invocation line at the top of your code.

@Anurag recommended using rvm, which I'll second. I use it to manage 1.8.7 and 1.9.1 in addition to the OS's 1.8.6.

Greg