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”

22 Responses to “Fixing: uninitialized constant Gem::GemRunner (NameError) – Ubuntu”

  1. val - December 9th, 2008

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

  2. Paul - December 15th, 2008

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

  3. Infolookup - December 20th, 2008

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

  4. Pavel - December 30th, 2008

    Thanks a lot, man! :)

  5. Dave - December 30th, 2008

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

    Appreciated!

  6. Zeba - January 5th, 2009

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

  7. Darren Jones - January 11th, 2009

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

  8. Andrew Bowden - January 19th, 2009

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

  9. Milan Andric - February 5th, 2009

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

  10. Juan Barrientos - February 10th, 2009

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

  11. Tyler - February 26th, 2009

    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 - March 4th, 2009

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

  13. manish nautiyal - March 4th, 2009

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

  14. media-scientific - IT Blog » Blog Archive » Rubygems ERROR - Warning: Gem::manage_gems… - March 4th, 2009

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

  15. Jason - March 17th, 2009

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

  16. Antanas - March 18th, 2009

    Thank you so much!

  17. Swati Yadav - April 8th, 2009

    Thanksa lot

  18. Natalie - April 10th, 2009

    Thank you so much…I was completely stumped

  19. Andre - April 15th, 2009

    Thank you!

  20. Keith - April 16th, 2009

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

  21. Ethan - July 20th, 2009

    Thanks a bunch!

  22. Fiber - January 17th, 2010

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

Leave a Reply