RubyGems: undefined method ‘manage_gems’ for Gem:Module (NoMethodError)
Posted: April 30th, 2009 | Author: vid | Filed under: Development | Tags: error, fix, ruby, rubygems, update | 63 Comments »Update: There’s a more efficient solution to this problem here: The Easy Fix
After updating RubyGems I got the following error message:
/usr/bin/gem:10: undefined method `manage_gems' for Gem:Module (NoMethodError)
#
#
Nice. So I took a look at the output that was generated and came across this:
Deprecation Notices:
* Gem::manage_gems has been removed.
* Time::today will be removed in RubyGems 1.4.
* Gem::manage_gems has been removed.
* Time::today will be removed in RubyGems 1.4.
Now what? Right – fix it.
sudo vim /usr/bin/gem
Search “Gem.manage_gems” and remove it or replace it with
#Gem.manage_gems
Unfortunately i got this
/usr/bin/gem:23: uninitialized constant Gem::GemRunner (NameError)
#
#
when running the gems command. After “googling” I came up with this:
sudo vim /usr/bin/gem
inserting
require 'rubygems/gem_runner'
so that the first lines of /usr/bin/gem look like this
require 'rubygems'
require 'rubygems/gem_runner'
#Gem.manage_gems
require 'rubygems/gem_runner'
#Gem.manage_gems
Fixed.
Thx. It solved my problem.
Thanks!! It works for me too!
Thanks
=)
Thanks a lot man !
Thanks 2!!!
You’re my hero
Thanks a ton.
Great !
Problem solved on Ubuntu / ruby 1.86
Thanks !
Just what I was looking for!! Thank you very much.
Nice one, fixed my issue and allowed me to install a specific version of rails. Thank you!
Worked here too. Dumb bugs! hahah
That did the trick on Xubuntu 8.04. Thanks for the gem.
thank you for this fix. that saved my day!
Tnx!
Thank a lots
Thanks a bunch!
I really thanks for your effort on this. I also faced this problem. I went through your modification wherever is needed. It works fine for me. Thanks man.
Thanks a lot!
Respect!
Thanks! It worked for me too. Good on ya for sharing.
Thanks man! You rock
Thank’s that helped
Hmm, couldn’t you just replace /usr/bin/gem with /usr/bin/gem1.8? That’s what got installed by update_rubygems.
To fix it I just did:
sudo mv /usr/bin/gem1.8 /usr/bin/gem
thanks so much!!!
Thanks for the info!
very logical..: )
Thx!
Thanks a bunch!!
thx saved my day!
Thanks a lot for posting the solution to this issue!
Thanks!
Thanks!!
Yay, thanks.
Man, this is awesome. i saw this post previously, but blog theme is vired and I didn’t saw explanation text at all
Thanks, that’s what I was looking for.
Thanks ,very good to do
Thanks! it worked for me and I’m a total noob…
Didn’t. Ruby sucks.
Thanks! Muchas gracias!
Thanks. But how do you know this is the one that need to be written?
Very nice.
Thanks! Your still saving people with this tip! Found this on 3 Ubuntu 8.04 boxes today, couldn’t figure out what to do until I found your fix.
You r da walrus! I wasted an evening,.. and then found yr post. Now all is sunshine and champagne! Guys like you need a medal (or a holiday in the Pacific with a bevy of babes!). Cheers, Man!
Thanks. This happened to me today seven months after your post. Which makes me wonder, how come the code has not been fixed.
A number of curious people might have been put off Ruby during their very first encounter.
Thanks again, this kind of issue drives me mad. If only it just worked.
This helped me to solve my problem while upgrading from rails 1.2.3 to 1.2.6. Thanks.
Thanks for that. It’s done the trick – I need things to Just Work to get by my boss and was beginning to get very annoyed at Ruby today!
On ubuntu hardy, I found this happened after doing “gem update –system”, which seemed to update /usr/bin/gem1.8 but not /usr/bin/gem. So I fixed this way instead:
rm /usr/bin/gem
ln -s /usr/bin/gem1.8 /usr/bin/gem
Brilliant! Thank you!
Thanks !! Great post.
Many thanks… this fixed my issue
This is amazing, I can’t believe how awesome the open source community is. Much love!
First of all thanks for the post. Your fix solved my problem at first, but…
when trying to install rsruby using
gem install rsruby — –with-R-lib=/usr/lib/R/lib/ –with-R-include=/usr/share/R/include
I ran into some serious problems – not sure if your fix or a mistake by me applying the fix was the problem – Gem ignored all parameters after “–” so I couldn’t build the native extension because it didn’t find R.h or libR.so (ok this is very specific, but hopefully it will help someone someday)
I suggest to use the fix of Adam DiCarlo or as a quick fix just paste this into your /usr/bin/gem
#! /usr/bin/ruby1.8
#–
# Copyright 2006 by Chad Fowler, Rich Kilmer, Jim Weirich and others.
# All rights reserved.
# See LICENSE.txt for permissions.
#++
require ‘rubygems’
require ‘rubygems/gem_runner’
required_version = Gem::Version::Requirement.new(“>= 1.8.0″)
unless required_version.satisfied_by?(Gem::Version.new(RUBY_VERSION))
puts “Expected Ruby Version #{required_version}, was #{RUBY_VERSION}”
exit(1)
end
# We need to preserve the original ARGV to use for passing gem options
# to source gems. If there is a — in the line, strip all options after
# it…its for the source building process.
args = ARGV.clone
begin
Gem::GemRunner.new.run args
rescue Gem::SystemExitException => e
exit e.exit_code
end
This code contains some parts from another gem installation and it worked fine for me.
Cheers
Marcel’s fix worked for me.
Thank you very much; I was just about to get really frustrated, and I’m not a *nix novice either. very helpful!
cheers. great.
Thanks for this
Your a life saver!
thks,
thats exactly what i was searching for
and it fixed my issue
I just wanted to note that I got this error when trying to do a ‘rake rails:freeze:gems’. Another blog out there recommended doing a ‘rake rails:unfreeze’ to fix the problem. In my case, that was all that was needed.
THANK YOU!!!
Nice work, thanks.
On a more serious note, why does this problem exist in the first place?? Unprofessional.
Awesome, thanks for the fix!
Valeu, matou a pau!
Awesome, nice fix!