How to uninstall Rubygems that are installed in your home directory
With RubyGems (version 1.3.1 as of this writing), if you don’t have root access on a system, you can install gems to your home directory (the gems live in ~/.gem)
In fact, if you just do:
gem install <gemname>
it will install it to your ~/.gem directory by default. This actually confused me at first, because older versions of Rubygems would try to install to the system-wide gems dir and warn you that you didn’t have access (at which point, I’d just append sudo to the previous command). Now it just magically “works”, but you find out later on that no one else on the system has access to the gem you just installed.
Anyway, once I install a gem in my home directory, I’d expect that
gem uninstall <gemname>
would find it and uninstall it by default. Unfortunately, when you do this, all you get is:
ERROR: While executing gem ... (Gem::InstallError)
Unknown gem <gemname> >= 0
The trick is to specify the install dir like so:
gem uninstall <gemname> -i ~/.gem/ruby/1.8

