Fixing: uninitialized constant Gem::GemRunner (NameError) – Ubuntu

After upgrading to the newest version of rails (2.2.2) I was getting this error:

administrator@shuttle:~/$ gem -v
/usr/bin/gem:10:Warning: Gem::manage_gems is deprecated and will be removed on or after March 2009.
/usr/bin/gem:23: uninitialized constant Gem::GemRunner (NameError)

Anytime I called “gem” I would get this error and could not get past.

Here is the fix

administrator@shuttle:~/$ sudo vim /usr/bin/gem

Change the top of the file to look like this:

require 'rubygems'
require 'rubygems/gem_runner'
#Gem.manage_gems

Save and when you run this you should see this:

administrator@shuttle:~/$ gem -v
1.3.1

You should no longer get the error with running “gem”

23 Comments

  1. val
    Dec 09, 2008 @ 20:34:25

    Thaaanks Nick!!! You saved my hours of pain!!!

  2. Paul
    Dec 15, 2008 @ 13:24:36

    Thanks, that’s really helped us out :) Have a great XMAS too…

  3. Infolookup
    Dec 20, 2008 @ 15:06:01

    Thank you I wish I found this earlier last night I was up going crazy.

  4. Pavel
    Dec 30, 2008 @ 13:12:20

    Thanks a lot, man! :)

  5. Dave
    Dec 30, 2008 @ 15:30:08

    You are a life saver! I was ripping my hair out trying to get this working!

    Appreciated!

  6. Zeba
    Jan 05, 2009 @ 03:23:14

    Thanks..a lot….That saved a lot of time..!!!!
    Thank you…again…

  7. Darren Jones
    Jan 11, 2009 @ 14:23:29

    You have saved me hours of pulling my hair out over this. Thank you.

  8. Andrew Bowden
    Jan 19, 2009 @ 01:26:19

    thanks for posting this, fingers crossed but this seems to work with a Debian install as well.

  9. Milan Andric
    Feb 05, 2009 @ 00:22:35

    yep, worked on debian etch package as well. was about to give up on my rails setup.

  10. Juan Barrientos
    Feb 10, 2009 @ 03:36:28

    Hey, thanks, very useful, save me a headache.

  11. Tyler
    Feb 26, 2009 @ 01:33:25

    Well, that got gem working again…Sort of. When I try sudo gem install rails-1.2.5 it gives the “cannot find this package anywhere” crap again.

  12. Philipp
    Mar 04, 2009 @ 11:27:19

    Thank you very much… That is very usefull and save me hours.

  13. manish nautiyal
    Mar 04, 2009 @ 13:38:17

    thank you very much………..its very helpful……

  14. media-scientific - IT Blog » Blog Archive » Rubygems ERROR - Warning: Gem::manage_gems…
    Mar 04, 2009 @ 15:15:35

    [...] Englische Quelle ist hier zu finden. Tags: rubygems Posted in Ruby on März 4, [...]

  15. Jason
    Mar 17, 2009 @ 23:48:28

    Thanks, works for me (Ubuntu / Linux 2.6.24-19)

  16. Antanas
    Mar 18, 2009 @ 09:08:27

    Thank you so much!

  17. Swati Yadav
    Apr 08, 2009 @ 01:13:23

    Thanksa lot

  18. Natalie
    Apr 10, 2009 @ 18:40:00

    Thank you so much…I was completely stumped

  19. Andre
    Apr 15, 2009 @ 11:07:01

    Thank you!

  20. Keith
    Apr 16, 2009 @ 14:59:59

    Thanks, it is rediculous that this has been left!!

  21. Ethan
    Jul 20, 2009 @ 20:07:27

    Thanks a bunch!

  22. Fiber
    Jan 17, 2010 @ 14:33:52

    Thank you, much !!
    Width love? from Russia ! )))

  23. MLKiiwy
    Sep 16, 2010 @ 06:03:40

    Thanks a lot man :)

Leave a Reply

*