Updating RubyGems to Recent 1.3.x

Posted by on Jul 29, 2009 in Blog | Tags: , | 13 Comments

The RubyGems update process can be temperamental. If you fall more than a release or two behind, you might find yourself in a dependency cycle that stops an update cold. Recently, I tried to update a 1.2.0 install to the current 1.3.5.

# gem update --system
Updating RubyGems
Updating rubygems-update
Successfully installed rubygems-update-1.3.5
ERROR:  While executing gem ... (NameError)
    undefined local variable or method `remote_gemspecs' for

This is a known issue. Running the command again results in “nothing to update,” also a known issue. The fix is to separately install rubygems-update and run update_rubygems.

# gem install rubygems-update
Successfully installed rubygems-update-1.3.5
1 gem installed
Installing ri documentation for rubygems-update-1.3.5...
Installing RDoc documentation for rubygems-update-1.3.5...
Could not find main page README
Could not find main page README
Could not find main page README
Could not find main page README
# update_rubygems
/usr/lib/ruby/site_ruby/1.8/rubygems.rb:578:in `report_activate_error':
Could not find RubyGem builder (>= 0) (Gem::LoadError)
	from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:134:in `activate'
	from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:158:in `activate'
	from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:157:in `each'
	from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:157:in `activate'
	from /usr/lib/ruby/site_ruby/1.8/rubygems.rb:49:in `gem'
	from /usr/bin/update_rubygems:18

To fix this “report_activate_error”, I installed builder. Tried the update again, same thing for session and hoe-seattlerb. This is where I found myself in a dependency cycle.

rubygems-update 1.3.5 requires (among other things) hoe-seattlerb
hoe-seattlerb requires hoe >= 2.3.0
hoe >= 2.3.0 requires rubygems >= 1.3.1

I might have the specific dependency chain a bit off, but it’s enough to say that something required by rubygems-update itself requires a semi-recent RubyGems.

The solution is to update in stages. First update to 1.3.0, then update the rest of the way:

# gem install rubygems-update -v 1.3.0
Successfully installed rubygems-update-1.3.0
1 gem installed
# update_rubygems
Installing RubyGems 1.3.1
# gem update --system
Updating RubyGems
Updating rubygems-update
Successfully installed rubygems-update-1.3.5
:0:Warning: Gem::SourceIndex#search support for String patterns is deprecated
Updating RubyGems to 1.3.5
Installing RubyGems 1.3.5
RubyGems 1.3.5 installed


  1. Jesse
    August 18, 2009

    THANK YOU. Wow, what a pain that was to upgrade. So glad you posted this.

    Also, if you already tried to install it, you will need to uninstall 1.3.5 before installing 1.3:
    gem uninstall rubygems-update -v 1.3.5

  2. Brian
    August 18, 2009

    Thanks, this helped me. What a mess!

  3. James
    August 20, 2009

    Cheers to the article and to Jesse’s response about uninstalling if before you failed

  4. jon w
    September 8, 2009

    much appreciated.

  5. Shad Sharma
    October 3, 2009

    Very good post. Thanks a lot.

  6. Mrnicoco
    October 14, 2009

    Thank you very much ! headache avoided thanks to you !

  7. haschibaschi
    October 26, 2009

    Worked for me on debian lenny wit ruby 1.8 installed

  8. James
    October 27, 2009

    Awesome, thanks!

  9. Amit Shanker
    December 9, 2009

    a million thanks!

    had to run the update command 5 times to update from 1.3.0 to 1.3.5 updating by a version with every update.

  10. Chris
    February 18, 2010

    Thanks this post was a life saver, probably saved me several hours of trying to figure this out on my own.

  11. Ray
    February 19, 2010

    I keep getting an error that “rubygems is not found locally or in a repository”. Any ideas?

    • Steve
      February 21, 2010

      There isn’t a gem called “rubygems”. Double check the instructions in the post and make sure you aren’t running “gem update rubygems” or similar.

  12. Devin
    March 25, 2010

    Had this error come up when upgrading from 1.3.5 to 1.3.6. Your suggestion worked like a charm.