Fix for “uninitialized constant Gem::GemRunner (NameError)”

Monday, December 31st, 2007

I tried upgrading my version of rubygems to the most current version by running
sudo gem update --system
Which introduced this error:
/usr/bin/gem:23: uninitialized constant Gem::GemRunner(NameError)
whenever I tried to run rubygems. On the rails forum, I found a fix for it!
Simply add the line to the file /usr/bin/gem (may be different on a mac)
require 'rubygems/gem_runner'
after
require 'rubygems'
This fixed the issue in both Ubuntu and OS 10.4.

99 Responses to “Fix for “uninitialized constant Gem::GemRunner (NameError)””

  1. raggi

  2. Thanks, this helped me (once I figured out that the file I’m adding it to is /usr/bin/gem that is :)

    Hurt Reynolds

  3. Great fix!

    Syntaxius

  4. found your tip via google. that helps. thanks ~

    wilcohol

  5. Thanks Nick – that was a big help! Any ideas why this bug exists in Ubuntu? I’m using 7.10.

    -Dave

    Dave

  6. Thanks, I had the same problem and this fixed it for me as well. I’m using Ubuntu 7.04.

    -Aric

    Aric

  7. @hurt – Thanks. I made a change to reflect the appropriate file for Ubuntu.

    @Dave – I’m not sure. I was experiencing the same issue in OSX, so I think it was a bug in the gem software.

    Nick

  8. thanks! Great Help

    ochko

  9. THANKS!

    Rizwan Reza

  10. Worked on Mac 10.5

    you rock.

    philip

  11. 10x! saved me a lot of time! :)

    slony

  12. Super. Worked for me as well.

    Ubuntu ver 7.04

    ktheking

  13. hi, found this via google. had this bug on freebsd 6.2-release, too.

    britneyfreek

  14. Thank You !!!

    4-No0!3-15

  15. Thanks!

    Donnie

  16. Thanks a lot! Just what I needed.

    Lenart

  17. Thanks :D You’re a lot of people’s hero.

    Ed Anderson

  18. thank you!

    assente

  19. I know it’s a little redundant, but thank you!

    Calvin

  20. Thanks – yet again. Very fast find and fix.

    Mike Lunt

  21. Thanks

    Hugo

  22. Thanks, this worked with Solaris on Joyent too!

    Luke Noel-Storr

  23. thanks much for this!

    Jason

  24. THANKS!

    Sebastian

  25. Oh yeahh! It`s works

    mikahilov

  26. Wow, you save me so mutch time !

    Thank you!

    Carl

    Carl Pelletier

  27. Yet again: thanks!
    I just tried Ubuntu 7.10 for the first time and its great – except for this little bug.

    JohnB

  28. Thank you!

    chris

  29. That worked for me…. many thanks!!

    Zack

  30. Thanks… great help! Solved in Ubuntu Ultimate Edition.

    ffteixeira

  31. Thank you!!!!

    Cristiano87

  32. Thanks. Worked for me on a fb dev Joyent Accelerator running Solaris after updating to RubyGems 1.0.1.

    Erik P

  33. Thanks a lot!..

    grkn

  34. Thanks! Had this problem when updating a Debian box.

    hutchman

  35. found via google. Thanks!

    dave

  36. Thanks, worked for me in Ubuntu 7.10

    Denis

  37. Thanks for posting this– found via Google and it fixed my problem.

    Brandon Harper

  38. Google led me here, you’re number one for this error! Thanks a lot!

    Kolja

  39. Really thx!

    Dzs

  40. Thanks for posting this!

    Chris

  41. Thank you sir!

    Works… phew… Back to rails now… :D

    Raju

  42. Thanks… That Worked

    Frank

  43. You have resolved my problem.
    Really thank you.

    Riccardo Solimena

  44. Nice!
    Thank you.

    Kosh

  45. tkstkstks!

    fotanus

  46. great — very helpful — good work

    tim

  47. Nice. Worked for me. Thanks.

    Marcus

  48. Thanks a lot – got things working again

    Tyler

  49. excellent. cheers for post

    Andy GOUNDRY

  50. 10x a lot, found you by google :)

    Portal

  51. Thanks for this – happy again.

    UK Credit Fraud

  52. Your fix should be ranked so much higher on Google. I went through so much shit, before I got to your solution. Did it and it worked fine! Thanks.

    Word of advice to my fellow n00bs. If you can’t edit the file it’s because of permissions. Open up a terminal. Go to the folder where it’s located. Then type:
    sudo gedit gem

    Zach

  53. Thanks! … my system was broken.

    Todd

  54. Works on SuSE 10.3 and you’re still 1st hit on Google. Thanks for posting the fix.

    James

  55. Thanks! Google got me here too. Easy fix saved much time.

    Ken Weiner

  56. THANK YOU!

    brittany

  57. thanks! that helps!!

    zain alabdin tawfiq

  58. Great Fix!! Thanks!

    rugger

  59. works! thanks a lot for the help.

    Omar Bohsali

  60. I’m the 1234th person to say thanks man.

    now get off this wordpress garbage and on to a real blog platform… mephisto or typo :-)

    thanks again.

    nerb

  61. All these great comments should make you feel wanted :) Thanks for sharing your knowledge.

    philz

  62. Great post. Many thanks !

    Rob

  63. thanks

    spark

  64. Works on Ubuntu Hardy Heron. Thanks!

    Paul

  65. thanks, saved my life.

    daniel

  66. Thanks!

    Ben

  67. For the One Millionth Time – Thanks!

    pRick

  68. Thanks man.

    Dr. Scotty Delicious, DFPA

  69. This fixed the gems NameError for me after upgrading to XCode 3.0 in OS 10.5. Thank you!

    Katherine Doubek

  70. still relevant in Kubuntu Hardy Heron – thanks!

    jdzzle

  71. thanks! It really helps us newbies when kind folks in the know post their trials and solutions..

    bronius

  72. Thanks a lot!

    Manu

  73. Thanks!

    Heinz

  74. worked on ubuntu 8.04 (hardy)

    lucas luky

  75. Add me to the list of the thankful! This was such an easy fix and I found it without having to wade through pages of other useless info. THANKS!!!
    (Kubuntu 8.04 (hardy heron)

    Mark

  76. Thanks! This was just what I was looking for. Finally i can run my app on debian!

    Sam

  77. The real reason for this not working is that you still had an old version of /usr/bin/gem installed. The latest gem (1.2.0) install /usr/bin/gem1.8. if you run that directly it works fine:

    $ /usr/bin/gem1.8 list

    You should really be using the latest version, so move the old one out of the way and create a symlink to the new one:

    $ sudo mv /usr/bin/gem /usr/bin/gem.OLD
    $ sudo ln -s /usr/bin/gem1.8 /usr/bin/gem

    $ ls -al /usr/bin/gem*
    lrwxrwxrwx 1 root root 15 2008-08-22 17:19 /usr/bin/gem -> /usr/bin/gem1.8
    -rwxr-xr-x 1 root root 785 2008-08-22 17:00 /usr/bin/gem1.8

    Hope that helps everyone’s understanding :-)

    Simon

    Wongy

  78. Thanks for the post, came up first in google for me.

    Thanks Simon as well. Both solutions worked for me in Hardy.

    Aaron Junod

  79. Thanks

    Juo100

  80. fix0rD!

    R0R

  81. Like the othoer ones: Really THANKS!

    cvielma

  82. this is grrrreat!

    me

  83. Awesome. That did the trick. Worked perfectly for Hardy – 8.04.1

    redconfetti

  84. thanks zach for the n00b info!!

    em

  85. Ditto, why it kept the old one infavor of the new one, I do not know…

    Makes more sense to rename the old one to /usr/bin/gem.9.5

    oh well. Thank you!

    anthony ettinger

  86. Thanks dude keep it up ..

    Mayank Jain

  87. Thanks you

    Abdul Basit

  88. Thanks. you are very very smart

    buyanbat

  89. You rock

    Mercurious

  90. greattttttttttttttttttttttt

    fabio

  91. Thanks both Nick and Simon, worked nicely on Ubuntu 7.10.

    maafy6

  92. Also worked with Debian Etch

    DSidious

  93. Hey,

    for me the ‘rubygems/gem_runner’ its there but m still getting the error, any idea?

    Rechae

  94. Thanks! it worked.

    Spalis

  95. thanks for the fix this problem was starting to really get on my nerves :)

    Yorkshire Terrier

  96. I already have the line rubygems/gem_runner also, but still getting the error.
    Any ideas?

    me2

  97. Simon’s comment on August 22nd, 2008 worked for me

    jDeppen

  98. Thanks, still helpful today :-)

    Achim

  99. Thanks a bunch! Worked like a charm.

    PEZ

Leave a Reply