Fixing the Broken Pipes: Updating RubyGems

posted by andy, Tue Oct 14 14:30:00 UTC 2008

Why do we need the plumber?

If you're like me you might slip into a comfort zone and not keep up with all the updates to gems and plugins, especially since github has taken plugin/gem development and forking viral. Usually that's not much of a problem. Unless, of course, the change is to the gem package manager itself.

I'm not sure exactly what changed. What I know is that any time I tried to do a '(sudo) gem install my-cool-gem' it failed with an error that looked like this


Bulk updating Gem source index for: http://gems.rubyforge.org/
Bulk updating Gem source index for: http://gems.github.org/
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
     Errno::EPIPE: Broken pipe reading http://gems.rubyforge.org/gems/...some-poor-gem.gem

As best as google has been able to help me find the problem lay in the the increasingly large number of gems available. The large, uncompressed source of gems times out the connection. Fortunately that appears to be fixed in the latest version of rubygems. Version 1.3.0 was released yesterday. But now you've got a chicken-and-egg problem if you have relied on gems to update itself -- the Broken Pipe problem prevents you from getting the version that doesn't have the Broken Pipe problem.

Installing the gem locally

The simple answer to the question is to install the gem from a local source rather than a remote source. It works the same as the tried and true "gem install my-cool-gem" with just one extra step. Here's what I did specifically to fix the issue with the gem package manager.

  1. Navigate over to the rubygems download page at rubyforge.
  2. Download the latest rubygems-update gem (currently rubygems-update-1.3.0.gem)
  3. Move the gem somewhere handy in case you want to install it again.
    Personally I created a Gems subfolder and moved the gem from ~/Desktop to ~/Gems.
  4. Install the gem locally using a locally named source:
    sudo gem install rubygems-update -n ~/Gems
  5. Once the gem update is installed you still have one more step! (Emphasis for my own needs -- I keep forgetting this). From the command line:
    update_rubygems

Once I updated to rubygems v 1.3.0 the Broken Pipe Problem disappeared on my Ubuntu box. Hope the same is true for you!

Filed Under: | Tags:

Comments