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”

Posted on November 29, 2008 at 10:41 am by nickdenardis · Permalink
In: rails · Tagged with: , , ,

23 Responses

Subscribe to comments via RSS

  1. Written by val
    on December 9, 2008 at 8:34 pm
    Permalink

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

  2. Written by Paul
    on December 15, 2008 at 1:24 pm
    Permalink

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

  3. Written by Infolookup
    on December 20, 2008 at 3:06 pm
    Permalink

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

  4. Written by Pavel
    on December 30, 2008 at 1:12 pm
    Permalink

    Thanks a lot, man! :)

  5. Written by Dave
    on December 30, 2008 at 3:30 pm
    Permalink

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

    Appreciated!

  6. Written by Zeba
    on January 5, 2009 at 3:23 am
    Permalink

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

  7. Written by Darren Jones
    on January 11, 2009 at 2:23 pm
    Permalink

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

  8. Written by Andrew Bowden
    on January 19, 2009 at 1:26 am
    Permalink

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

  9. Written by Milan Andric
    on February 5, 2009 at 12:22 am
    Permalink

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

  10. Written by Juan Barrientos
    on February 10, 2009 at 3:36 am
    Permalink

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

  11. Written by Tyler
    on February 26, 2009 at 1:33 am
    Permalink

    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. Written by Philipp
    on March 4, 2009 at 11:27 am
    Permalink

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

  13. Written by manish nautiyal
    on March 4, 2009 at 1:38 pm
    Permalink

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

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

  15. Written by Jason
    on March 17, 2009 at 11:48 pm
    Permalink

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

  16. Written by Antanas
    on March 18, 2009 at 9:08 am
    Permalink

    Thank you so much!

  17. Written by Swati Yadav
    on April 8, 2009 at 1:13 am
    Permalink

    Thanksa lot

  18. Written by Natalie
    on April 10, 2009 at 6:40 pm
    Permalink

    Thank you so much…I was completely stumped

  19. Written by Andre
    on April 15, 2009 at 11:07 am
    Permalink

    Thank you!

  20. Written by Keith
    on April 16, 2009 at 2:59 pm
    Permalink

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

  21. Written by Ethan
    on July 20, 2009 at 8:07 pm
    Permalink

    Thanks a bunch!

  22. Written by Fiber
    on January 17, 2010 at 2:33 pm
    Permalink

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

  23. Written by MLKiiwy
    on September 16, 2010 at 6:03 am
    Permalink

    Thanks a lot man :)

Subscribe to comments via RSS

Leave a Reply