{ |one, step, back| }

Delete Your RubyGems Cache
02 Jul 06 - http://onestepback.org/index.cgi/Tech/Ruby/DeleteYourCache.red

Several people have been having RubyGems issues.

Deleting Your RubyGems Cache

Several people have been reporting problems where RubyGems doesn’t find a gem on RubyForge, or gives other strange errors. It seems there was a gem on RubyForge that gave the Gem indexing software some headaches. And as a result, the gem index was corrupted. If you downloaded the corrupt index, then you may be experiencing strange problems as well.

The good news is that the problem is easy ot fix. Just delete the gem index file. You can find it in the directory reported by the “gem env gemdir” command. For example:

$ gem env gemdir
PATH_TO_DEFAULT_GEM_REPOSITORY
$ rm PATH_TO_DEFAULT_GEM_REPOSITORY/souce_cache

Where PATH_TO_DEFAULT_GEM_REPOSITORY is your default gem repository.

If you run on a Unix system, you default gem repository is probably non-writable from your regular user account. In that case, you will need to use “sudo” (or its equivalent) on the “rm” command. You will probably also have a secondary writable cache in your .gem directory that you will want to delete.

$ rm $HOME/.gem/source_cache

The next time you run gems, will will refresh the cache by downloading the index from scratch.