Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have messed up my ruby dev environment on Ubuntu 10.04.

I need to install Ruby this time using RVM. What is the best possible way to remove:

  • Ruby
  • All Gems
  • RubyGems

From my machine, so that I can start fresh with RVM?

share|improve this question
How did you install it? Did you use the the Ubuntu packages? – txwikinger Jul 28 '10 at 20:13
up vote 14 down vote accepted

If you're using Ubuntu Packages run sudo apt-get purge <packages>

So that should be something like:

sudo apt-get purge ruby rubygems

From the apt-get man page:

      purge is identical to remove except that packages are removed and purged (any configuration files are deleted too).
share|improve this answer

If you are using RVM why bother even uninstalling the system ruby?

I install both 1.8.7 and 1.9.2-rc via RVM.

After you have installed RVM you can set the RVM 1.8.7 to be your default ruby installation. Just don't install RVM as root.

For those wondering, has the RVM install instructions.

Make sure you read the instructions on what packages you need to install for Ubuntu before installing 1.8.7 via RVM. If you don't install them you may have issues with some gems.

share|improve this answer
I was going to answer with this as well! Don't waste your time, the new RVM environment will take precedence over your borked system environment. – Derek Jan 3 '11 at 12:14
The RVM installation doesn't seem to work behind a firewall. – Reinis I. Nov 30 '11 at 15:20

Using synaptic, you can remove the Ruby packages (select "completely remove" option). I guess this is the equivalent of the commandline: sudo apt-get purge

Now for the gems: they are not considered as packages. You will need to delete them manually (unless you want to use Ruby to do it, but since you say it's broken...)

By default, the Ruby gems are installed in your home folder, under the .gem folder. If you really want to get things clean, just delete ~/.gem, and it should be enough. When you reinstall Ruby and everything, the folder will get created again, and you will be good to go.

share|improve this answer
Gems installed as root seem to find their way to /var/lib/gems, it's probably worth cleaning there too. – Matt Aug 1 '10 at 8:25

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.