How to uninstall Ruby from /usr/local?

Shreyas picture Shreyas · Apr 7, 2010 · Viewed 129.9k times · Source

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 !

Answer

Mukesh Singh Rathaur picture Mukesh Singh Rathaur · Jan 20, 2011

Edit: As suggested in comments. This solution is for Linux OS. That too if you have installed ruby manually from package-manager.

If you want to have multiple ruby versions, better to have RVM. In that case you don't need to remove ruby older version.

Still if want to remove then follow the steps below:

First you should find where Ruby is:

whereis ruby

will list all the places where it exists on your system, then you can remove all them explicitly. Or you can use something like this:

rm -rf /usr/local/lib/ruby
rm -rf /usr/lib/ruby
rm -f /usr/local/bin/ruby
rm -f /usr/bin/ruby
rm -f /usr/local/bin/irb
rm -f /usr/bin/irb
rm -f /usr/local/bin/gem
rm -f /usr/bin/gem