How to Uninstall Ruby on Ubuntu

How can I uninstall Ruby on ubuntu?

This command should do the trick (provided that you installed it using a dpkg-based packet manager):

aptitude purge ruby

How to remove Ruby from Ubuntu


Use this to find out what executable you're running:

$ which ruby

Use this to find out what it actually is:

$ readlink -f /usr/bin/ruby

Use this to find out what package it belongs to:

$ dpkg -S /usr/bin/ruby1.8
ruby1.8: /usr/bin/ruby1.8

Use this to uninstall that:

$ apt-get purge ruby1.8

Note: If you have installed Ruby using Version/Environment managers like RVM or Rbenv then this method is not gonna work because Rubies will be installed as scripts not packages.

how to uninstall ruby

sudo apt-get purge ruby rubygems

It can remove ruby which installed by apt-get

How to remove ruby completely from my linux system

If you still have that /tmp/ruby directory, than go there and run

$ sudo make uninstall

This command will uninstall all previously installed files from that ruby. It usually installs into /usr directory, so if you had a system ruby (installed from Synaptic or apt-get (it seems you're using Debian-based system such as Ubuntu) could also break your system ruby, you need to reinstall it too. You can find out it this way:

$ sudo apt-get install aptitude # install aptitude for easy searching
$ aptitude search ruby | grep ^i # find all installed packages, containing ruby in their titles

In contrast, rbenv or rvm don't use your system paths for installation, instead they use your home folder and install to a path like ~/.rbenv, but since you mess up your system folder rbenv may look to a different place (it's hard to say for sure what's going on right now).

After you've cleaned up your unwanted ruby installation, use ruby-build to install desired ruby with rbenv:

$ git clone ~/.rbenv/plugins/ruby-build # install ruby-build
$ rbenv install -l # list available versions
$ rbenv install 2.2.3 # install desired version

I hope that helps.

How to uninstall Ruby from /usr/local?

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.

error in uninstalling Ruby from UBUNTU 14.0.4 LTS

I have removed the ruby directory from home directory and followed the below steps...

$ whereis ruby
ruby: /usr/local/bin/ruby /usr/local/lib/ruby

$ ruby -v
ruby 1.8.7 (2013-06-27 patchlevel 374) [x86_64-linux]

$ sudo rm -rf /usr/local/bin/ruby
$ sudo rm -rf /usr/local/lib/ruby
$ ruby -v
bash: /usr/local/bin/ruby: No such file or directory

finally it got uninstalled !!
Thanks to Rick

Related Topics

Leave a reply