How to Uninstall Ruby Installed by Ruby-Install

uninstall ruby version from rbenv

New way

Use the uninstall command: rbenv uninstall [-f|--force] <version>

rbenv uninstall 2.1.0  # Uninstall Ruby 2.1.0

Use rbenv versions to see which versions you have installed.

Old way

To remove a Ruby version from rbenv, delete the corresponding directory in ~/.rbenv/versions. E.g.

rm -rf ~/.rbenv/versions/1.9.3-p0

Run rbenv rehash afterwards to clean up any stale shimmed binaries from the removed version.

how to uninstall ruby

sudo apt-get purge ruby rubygems

It can remove ruby which installed by apt-get

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.

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 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 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

Related Topics

Leave a reply