gem won’t install Ruby gems on VPS…
July 28th, 2009 Posted in System administration | No Comments »Having trouble installing Ruby gems on your VPS? Gem was hanging on my Slicehost slice (running Ubuntu Hardy with 256MB of RAM) at “Bulk updating [...]“:
Updating installed gems...
Bulk updating Gem source index for: http://gems.rubyforge.org
It was also gobbling up CPU and memory.
Why does gem hang?
The distro package for Gem is very old, and this old version uses a lot of memory, causing lots of disk thrashing. Since hard disks are, ahem, a bit slower than RAM, this increases gem’s run time by probably a few orders of magnitude.
Solution
Update gem manually:
$ sudo gem install rubygems-update-1.3.4.gem
$ sudo /var/lib/gems/1.8/bin/update_rubygems
Installing RubyGems 1.3.4
Installing RubyGems
Installing gem executable
Removing old source_cache files
Removing old RubyGems RDoc and ri
Installing rubygems-1.3.4 ri into /usr/lib/ruby/gems/1.8/doc/rubygems-1.3.4/ri
Installing rubygems-1.3.4 rdoc into /usr/lib/ruby/gems/1.8/doc/rubygems-1.3.4/rdoc
RubyGems installed the following executables:
/usr/bin/gem1.8
Looks like everything’s OK, but gem didn’t work anymore:
/usr/bin/gem:10: undefined method `manage_gems' for Gem:Module (NoMethodError)
What gives? Notice the path, /usr/bin/gem. Is that still the old version?
-rwxr-xr-x 1 root root 701 Nov 19 2007 /usr/bin/gem
-rwxr-xr-x 1 root root 545 Jul 28 00:15 /usr/bin/gem1.8
Yes. This is what we get for upgrading gem without using Ubuntu’s package system. Well, in for a penny, in for a pound:
Done. Now to install Haml and Sass….