Tuesday, 12 August 2008

Updating gem to 1.2.0 on Ubuntu

Like several others, I tried to gem update today and failed. It gave me weird error telling me it couldn't find the update gem in the repository:

%> sudo gem update --system
Updating RubyGems
Bulk updating Gem source index for: http://gems.rubyforge.org/
Updating rubygems-update
ERROR:  While executing gem ... (Gem::GemNotFoundException)
    could not find rubygems-update locally or in a repository

Googling gave me a fair few other links to people with the same issue. The main one seems to be listed under this ruby-forum topic which started as the release-notes for the Gem update to version 1.2.0. People that had problems updating to this gem listed their steps-to-reproduce in the replies below, and I tried all the suggestions.

sudo gem update --system was the original command I tried and it gave me the error as above. All the fora on the topic insisted that the workaround is to run: gem install rubygems-update -v 1.1.1, but this just gave the same error. I did note that most of these people were on various flavours of Mac, and the pleas for help from those on Ubuntu were drifting away into the sky unheard...

One forum user said he tried the above from his gem directory and that worked for him...
but not for me...

I even tried reinstalling ruby/rubygems via apt-get, but the former was latest version, and the latter doesn't exist...

I was about ready to nuke the site from orbit... and reinstall from scratch and went to the rubyforge page for rubygems. This lists the source code, but I also noticed it had individual "upgrade" gems available for download. This saved me from my previous scorched-earth plan, and eventually resulted in success. For future reference:

  1. copy rubygems-update-1.1.0.gem to a local directory
  2. then run: sudo gem install rubygems-update-1.1.0.gem
  3. repeat with rubygems-update-1.2.0.gem
  4. then run update_rubygems

Now it's all fine and sudo gem update --system happily fetches my new gems as before.

3 comments:

Anonymous said...

Thanks for the article.
I've just had the same problem trying to upgrade from 1.1.0 to 1.3.7. I followed the steps, but update_rubygems failed to work. So I just downloaded rubygems-update-1.3.7.gem as well and ran sudo gem install rubygems-update-1.3.7.gem and it started working.

manish said...

Thanks for this article

I've just had the same problem trying to upgrade from 1.2.0 to 1.3.7. I followed the steps, but update_rubygems failed to work.
So I just downloaded rubygems-update-1.3.7.gem from
http://rubyforge.org/frs/?group_id=126

gem install rubygems-update-1.3.7.gem

and it worked for me.

Taryn said...

Hi Manish.
It seems to be a common problem if you get even a little behind the current 'edge'... but at least it's reasonably easy to solve by just downloading the update gem.