31

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

What is the best possible way to remove these packages from my system?

  • Ruby
  • All Gems
  • RubyGems

To start fresh, I would like to re-install Ruby using RVM.

1
  • 1
    How did you install it? Did you use the the Ubuntu packages?
    – txwikinger
    Jul 28, 2010 at 20:13

4 Answers 4

25

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
      purge is identical to remove except that packages are removed and purged (any configuration files are deleted too).
1
  • 2
    sudo apt-get --purge autoremove packagename (as per this answer) worked better for me, as it also removed dependencies. One thing I'm not sure of is whether installed gems are also removed.
    – Jet Blue
    Aug 16, 2020 at 4:08
8

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, https://rvm.io/ 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.

2
  • 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, 2011 at 12:14
  • The RVM installation doesn't seem to work behind a firewall.
    – slikts
    Nov 30, 2011 at 15:20
5

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.

1
  • 5
    Gems installed as root seem to find their way to /var/lib/gems, it's probably worth cleaning there too.
    – Matt
    Aug 1, 2010 at 8:25
0

If you have installed Ruby using RVM then the following command will completely remove RVM installed directory:

 rvm implode

Running this command will ask for your confirmation to delete the .rvm directory.

After it completes deleting the .rvm directory, you get the following message which is worth notable:

Note you may need to manually remove /etc/rvmrc and ~/.rvmrc if they exist still.

Please check all .bashrc .bash_profile .profile and .zshrc for RVM source lines and delete or comment out if this was a Per-User installation.

Remove Ruby Gems

gem uninstall rvm

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .