Not finding a Ruby Gem? Maybe you need to monkey with your sources.
I was trying to install a gem on a client’s machine that I had previously been able to grab successfully, but it failed like this:
$ sudo gem install some_gem
Updating metadata for 475 gems from http://gems.rubyforge.org/
…
complete
ERROR: could not find some_gem locally or in a repository
I thought perhaps rubyforge was unavailable, so I repeated the command. Still no luck. I did a web search and found a possible answer:
$ gem sources -a http://gems.github.com/ # adds metadata for the gems hosted by github
That actually didn’t do it either. Including github’s gems slowed things down when doing a gem install, so I decided to remove it from the sources list:
$ gem sources -r http://gems.github.com/ # drops github’s gems metadata
So I tried a “gem help sources” and discovered that I could clear the local cache like so:
$ sudo gem sources -c
*** Removed user source cache ***
*** Removed latest user source cache ***
*** Removed system source cache ***
*** Removed latest system source cache ***
Then I tried the gem install again:
$ sudo gem install some_gem
Bulk updating Gem source index for: http://gems.rubyforge.org/
Successfully installed some_gem
1 gem installed
Installing ri documentation for some_gem
Installing RDoc documentation for some_gem
Success! Hope this helps someone else.

