I wanted to give mechanize a shot for a small prototype I was building. It’s been a while since I last ran the gem command so of course the first thing it would do was to update itself. For some reason, it got stuck forever. It turned out that the latest hpricot gem was trying to build itself from source (! - very strange!) and gem updater got stuck looking for a compatible compiler.
So I downloaded the mechanize gem from Rubyforge instead and ran
gem install mechanize-0.7.7.gem
However, the gem still tried to access the gem index and eventually got stuck somewhere. The ruby runtime ballooned up to more than 600MB as showed in Task Manager. I dug up the gem install command and it turns out the gem install can be forced to install without checking the dependencies and without updaing the local index. So the final gem command is
gem install mechanize-0.7.7.gem –no-ri –no-rdoc -f –no-update-sources
With the –no-update-sources flag, the gem won’t try to go off to http://gems.rubyforge.org and get the latest repository info but expecting there is already a local gem file.
Hope this help someone