Agile Development. more fun less stress.

RubyGems: undefined method ‘manage_gems’ for Gem:Module (NoMethodError)

Posted: April 30th, 2009 | Author: vid | Filed under: Development | Tags: , , , , | 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.

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

Fixed.


63 Comments on “RubyGems: undefined method ‘manage_gems’ for Gem:Module (NoMethodError)”

  1. 1 Laurent Farcy said at 18:27 on May 6th, 2009:

    Thx. It solved my problem.

  2. 2 Juan Carlos said at 13:57 on May 8th, 2009:

    Thanks!! It works for me too!

  3. 3 pililo said at 05:15 on May 11th, 2009:

    Thanks

    =)

  4. 4 Rexar said at 20:47 on May 13th, 2009:

    Thanks a lot man !

  5. 5 David said at 15:11 on May 18th, 2009:

    Thanks 2!!!

  6. 6 feby said at 19:05 on May 18th, 2009:

    You’re my hero :-)

  7. 7 Doug said at 17:11 on May 29th, 2009:

    Thanks a ton.

  8. 8 Jessie said at 10:19 on June 2nd, 2009:

    Great !
    Problem solved on Ubuntu / ruby 1.86
    Thanks !

  9. 9 Pablo said at 06:04 on June 4th, 2009:

    Just what I was looking for!! Thank you very much.

  10. 10 psynaptic said at 03:08 on June 8th, 2009:

    Nice one, fixed my issue and allowed me to install a specific version of rails. Thank you!

  11. 11 Mark said at 00:47 on June 11th, 2009:

    Worked here too. Dumb bugs! hahah

  12. 12 Bill said at 01:51 on June 17th, 2009:

    That did the trick on Xubuntu 8.04. Thanks for the gem.

  13. 13 akimo said at 12:11 on June 17th, 2009:

    thank you for this fix. that saved my day!

  14. 14 Wouter said at 23:06 on June 18th, 2009:

    Tnx!

  15. 15 Raviraj said at 12:38 on June 25th, 2009:

    Thank a lots

  16. 16 Aashish said at 09:55 on July 7th, 2009:

    Thanks a bunch!

  17. 17 Vellingiri said at 06:23 on July 9th, 2009:

    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.

  18. 18 angel said at 16:31 on July 9th, 2009:

    Thanks a lot!

    Respect!

  19. 19 Terry said at 21:53 on July 17th, 2009:

    Thanks! It worked for me too. Good on ya for sharing.

  20. 20 Ignacio said at 09:26 on July 21st, 2009:

    Thanks man! You rock

  21. 21 Noboru said at 09:40 on July 27th, 2009:

    Thank’s that helped

  22. 22 Adam DiCarlo said at 09:42 on July 28th, 2009:

    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

  23. 23 lfat said at 13:37 on August 7th, 2009:

    thanks so much!!!

  24. 24 Shane said at 14:10 on August 7th, 2009:

    Thanks for the info!

  25. 25 Ansuman said at 11:52 on August 13th, 2009:

    very logical..: )

  26. 26 sergej said at 16:09 on August 18th, 2009:

    Thx!

  27. 27 Sim said at 00:43 on August 21st, 2009:

    Thanks a bunch!!

  28. 28 phil said at 20:17 on August 21st, 2009:

    thx saved my day!

  29. 29 parth said at 04:33 on August 31st, 2009:

    Thanks a lot for posting the solution to this issue!

  30. 30 Edi said at 15:31 on September 21st, 2009:

    Thanks!

  31. 31 chemaff said at 11:52 on October 20th, 2009:

    Thanks!! :-)

  32. 32 Charles said at 20:06 on October 23rd, 2009:

    Yay, thanks.

  33. 33 umpirsky said at 09:44 on October 28th, 2009:

    Man, this is awesome. i saw this post previously, but blog theme is vired and I didn’t saw explanation text at all :)

  34. 34 Mr Anderson said at 00:59 on November 3rd, 2009:

    Thanks, that’s what I was looking for. ;)

  35. 35 Raul said at 16:17 on November 6th, 2009:

    Thanks ,very good to do

  36. 36 Miguel said at 03:20 on November 16th, 2009:

    Thanks! it worked for me and I’m a total noob…

  37. 37 Java said at 03:00 on November 20th, 2009:

    Didn’t. Ruby sucks.

  38. 38 Jaroslav said at 08:37 on November 28th, 2009:

    Thanks! Muchas gracias!

  39. 39 Bless said at 07:36 on December 8th, 2009:

    Thanks. But how do you know this is the one that need to be written?

  40. 40 Greg said at 01:29 on December 25th, 2009:

    Very nice.

  41. 41 John said at 21:56 on January 8th, 2010:

    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.

  42. 42 Dewd said at 07:05 on January 9th, 2010:

    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!

  43. 43 Jonathan said at 12:18 on January 12th, 2010:

    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.

  44. 44 UmitOz said at 18:05 on January 19th, 2010:

    This helped me to solve my problem while upgrading from rails 1.2.3 to 1.2.6. Thanks.

  45. 45 Irregular Shed said at 19:52 on January 25th, 2010:

    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!

  46. 46 Marcel said at 23:54 on February 22nd, 2010:

    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

  47. 47 Jonathan said at 00:58 on February 24th, 2010:

    Brilliant! Thank you!

  48. 48 Krzsyztof Niemkiewicz said at 16:19 on February 24th, 2010:

    Thanks !! Great post.

  49. 49 rosaltof said at 14:05 on March 2nd, 2010:

    Many thanks… this fixed my issue

  50. 50 Marc Ongaro said at 07:24 on March 9th, 2010:

    This is amazing, I can’t believe how awesome the open source community is. Much love!

  51. 51 Sebastian said at 19:12 on March 16th, 2010:

    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

  52. 52 Michael Mahemoff said at 02:05 on March 25th, 2010:

    Marcel’s fix worked for me.

  53. 53 Casey Davis said at 04:53 on March 27th, 2010:

    Thank you very much; I was just about to get really frustrated, and I’m not a *nix novice either. very helpful!

  54. 54 Don said at 21:39 on April 4th, 2010:

    cheers. great.

  55. 55 Nicolas Goles said at 06:19 on April 6th, 2010:

    Thanks for this :-)

  56. 56 Forrest Zeisler said at 19:09 on April 7th, 2010:

    Your a life saver!

  57. 57 eveevans said at 19:44 on April 21st, 2010:

    thks,
    thats exactly what i was searching for

    and it fixed my issue :)

  58. 58 Kris Kemper said at 04:23 on April 26th, 2010:

    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.

  59. 59 jgonzalez said at 13:34 on July 28th, 2010:

    THANK YOU!!!

  60. 60 Dave said at 01:42 on October 1st, 2010:

    Nice work, thanks.

    On a more serious note, why does this problem exist in the first place?? Unprofessional.

  61. 61 Nick said at 05:25 on January 31st, 2011:

    Awesome, thanks for the fix!

  62. 62 Cristiano Amaral said at 18:10 on March 2nd, 2011:

    Valeu, matou a pau!

  63. 63 Andy said at 04:54 on March 15th, 2011:

    Awesome, nice fix!


Leave a Reply