Thursday, January 29, 2009

Ways of Solving the Slow Gem Install Problem

I've written previously on how slow gem install was, which has been causing me much annoyance. But the tradeoff of having ease of installation for all the useful libraries that Ruby offers is just too hard to not fall back to using Ruby Gems again.

There are a few ways of solving the issue, which depends on which version of Rubygems you are using. Find this out by issuing the following command:


% gem -v

If you are using gem version < 1.2.0

The best way of solving this problem in this case is to install the gem directly from source, thereby bypassing the database load problem, e.g. getting stuck at this message for a long, long time:


% gem install curb
Bulk updating Gem source index for: http://gems.rubyforge.org/

For example, I wanted to install Ruby's version of libCurl called 'curb', to which the way in installing it while avoiding the database load by downloading the gem and installing it locally:


% wget http://rubyforge.org/frs/download.php/23825/curb-0.1.4.gem
% gem install --local curb-0.1.4.gem
Building native extensions. This could take a while...
Successfully installed curb-0.1.4
1 gem installed
Installing ri documentation for curb-0.1.4...
Installing RDoc documentation for curb-0.1.4...

That should take you less than 30 seconds, as opposed to 30 minutes if you waited for the silly gem database to load.

Use gem version = 1.2.0

The other way of solving this problem, is to use gem version 1.2.0. It has taken away the unnecessary function for the database to load, and goes straight into the task of installing the gem. To upgrade your ruby gem to the latest version, download it locally and give it an upgrade:


% wget http://rubyforge.org/frs/download.php/38844/rubygems-update-1.2.0.gem
% gem install rubygems-update-1.2.0.gem
Successfully installed rubygems-update-1.2.0
1 gem installed
% update_rubygems

[.. tons of install messages ..]

= Announce: RubyGems Release 1.2.0

Release 1.2.0 adds new features and fixes some bugs.

New features:

* RubyGems no longer performs bulk updates and instead only fetches the gemspec
files it needs. Alternate sources will need to upgrade to RubyGems 1.2 to
allow RubyGems to take advantage of the new metadata updater. If a pre 1.2
remote source is in the sources list, RubyGems will revert to the bulk update
code for compatibility.

[.. more install messages ..]

Yay! From their release notes, the problem has been addressed, but it's only a fix according to the authors.

Not by a sliver of chance am I convinced that they are able to reconcile the problem with their bulk update system, so I will stay with 1.2.0 for a long, long time, thank you very much!

0 comments:

Post a Comment