We have installed the rubygem application (version 1.3.6) on a Debian system by downloading the rubygems tar.gz archive and running the setup.rb command.

What is the best way to uninstall this application?


In future, if you have to install from tar.gz files, it's worth using the excellent "checkinstall" program, you just preceded the install command (whatever that might be) with "checkinstall", which will create a deb package and then install it.

You might be able to reinstall rubygems now using checkinstall and then remove it immediately afterwards with dpkg -r packagename.


Here's what I did to remove rubygems installed from .tar.gz on a Ubuntu system:

aptitude install checkinstall
wget http://rubyforge.org/frs/download.php/69365/rubygems-1.3.6.tgz
tar xfvz rubygems-1.3.6.tgz
cd rubygems-1.3.6
checkinstall ruby setup.rb

When asked, give it a name 'rubygems'. At this moment we have reinstalled the rubygems. Now we need to uninstall it:

dpkg -r rubygems
rm /usr/bin/gem1.8

And that's it. Clean uninstall of rubygems.

Btw: it's recommended to uninstall all gems prior to this, by doing gem uninstall <gem-name> on each gem.


Do you mean a specific gem like haml or something, or do you mean the whole gem management system?

To uninstall a gem:

gem uninstall NAME_OF_THE_GEM 

Use sudo if you are not root.

To uninstall ruby gems management system:

You have to options: 1) if you used REE - then jsut wipe REE folder and reinstall that same version again. By default REE is installed in /opt/ruby-enterprise-version-number/

2) if you used stock ruby (apt-get) then it's a little more complicated: Find where ruby is environment sitting:

ruby -e 'puts $:'

Should be something like /usr/local/lib/ruby

change to the directory that has lib/site_ruby/1.8 in it. Based on you environment that could vary.

rm -r rubygems.rb ubygems.rb rubygems

Also remove gem executable.

which gem

Will tell you where executable for gem is sitting By default it should be in: /usr/local/bin/gem & /usr/bin/gem1.8 - just rm -rf on this two items and you are good to go. In the future thou, I highly suggest you use: either Ruby Enterprise Edition (http://www.rubyenterpriseedition.com/) - it's GPL, free, and has very good and stable reputation - also runs great with Passenger, if you need to deploy rails apps or use apt-get or aptitude.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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