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 insta
do this way :
sudo apt purge ruby
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.
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 explicitly 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.
sudo make uninstall did the trick for me using the Ruby 2.4 tar from the official downloads page.
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
If ruby was installed in the following way:
./configure --prefix=/usr/local
make
sudo make install
You can uninstall it in the following way:
Check installed ruby version; lets assume 2.1.2
wget http://cache.ruby-lang.org/pub/ruby/2.1/ruby-2.1.2.tar.bz2
bunzip ...
tar xfv ...
cd ruby-2.1.2
./configure --prefix=/usr/local
make
sudo checkinstall
# will build deb or rpm package and try to install it
After installation, you can now remove the package and it will remove the directories/files/etc.
sudo rpm -e ruby # or dpkg -P ruby (for Debian-like systems)
There might be some artifacts left:
Removing ruby ...
warning: while removing ruby, directory '/usr/local/lib/ruby/gems/2.1.0/gems' not empty so not removed.
...
Remove them manually.