Updating RubyGems to Recent 1.3.x
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 #<Gem::Commands::UpdateCommand:0xb7e26640>
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
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
Thanks, this helped me. What a mess!
Cheers to the article and to Jesse’s response about uninstalling if before you failed
much appreciated.
Very good post. Thanks a lot.
Thank you very much ! headache avoided thanks to you !
Worked for me on debian lenny wit ruby 1.8 installed
Awesome, thanks!
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.
Thanks this post was a life saver, probably saved me several hours of trying to figure this out on my own.
I keep getting an error that “rubygems is not found locally or in a repository”. Any ideas?
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.
Had this error come up when upgrading from 1.3.5 to 1.3.6. Your suggestion worked like a charm.