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.


Some more info on this gem runner error here:
http://blog.ra66i.org/archives/informatics/2007/12/23/a-quick-gem-101-faq-gemrunner-name-error/
Enjoy.
raggi
January 1st, 2008
Thanks, this helped me (once I figured out that the file I’m adding it to is /usr/bin/gem that is :)
Hurt Reynolds
January 2nd, 2008
Great fix!
Syntaxius
January 3rd, 2008
found your tip via google. that helps. thanks ~
wilcohol
January 3rd, 2008
Thanks Nick – that was a big help! Any ideas why this bug exists in Ubuntu? I’m using 7.10.
-Dave
Dave
January 4th, 2008
Thanks, I had the same problem and this fixed it for me as well. I’m using Ubuntu 7.04.
-Aric
Aric
January 9th, 2008
@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
January 9th, 2008
thanks! Great Help
ochko
January 10th, 2008
THANKS!
Rizwan Reza
January 12th, 2008
Worked on Mac 10.5
you rock.
philip
January 14th, 2008
10x! saved me a lot of time! :)
slony
January 14th, 2008
Super. Worked for me as well.
Ubuntu ver 7.04
ktheking
January 15th, 2008
hi, found this via google. had this bug on freebsd 6.2-release, too.
britneyfreek
January 15th, 2008
Thank You !!!
4-No0!3-15
January 16th, 2008
Thanks!
Donnie
January 16th, 2008
Thanks a lot! Just what I needed.
Lenart
January 18th, 2008
Thanks :D You’re a lot of people’s hero.
Ed Anderson
January 18th, 2008
thank you!
assente
January 19th, 2008
I know it’s a little redundant, but thank you!
Calvin
January 19th, 2008
Thanks – yet again. Very fast find and fix.
Mike Lunt
January 20th, 2008
Thanks
Hugo
January 22nd, 2008
Thanks, this worked with Solaris on Joyent too!
Luke Noel-Storr
January 23rd, 2008
thanks much for this!
Jason
January 24th, 2008
THANKS!
Sebastian
January 25th, 2008
Oh yeahh! It`s works
mikahilov
January 25th, 2008
Wow, you save me so mutch time !
Thank you!
Carl
Carl Pelletier
January 25th, 2008
Yet again: thanks!
I just tried Ubuntu 7.10 for the first time and its great – except for this little bug.
JohnB
January 25th, 2008
Thank you!
chris
January 28th, 2008
That worked for me…. many thanks!!
Zack
January 29th, 2008
Thanks… great help! Solved in Ubuntu Ultimate Edition.
ffteixeira
January 29th, 2008
Thank you!!!!
Cristiano87
January 29th, 2008
Thanks. Worked for me on a fb dev Joyent Accelerator running Solaris after updating to RubyGems 1.0.1.
Erik P
January 29th, 2008
Thanks a lot!..
grkn
January 30th, 2008
Thanks! Had this problem when updating a Debian box.
hutchman
February 3rd, 2008
found via google. Thanks!
dave
February 3rd, 2008
Thanks, worked for me in Ubuntu 7.10
Denis
February 4th, 2008
Thanks for posting this– found via Google and it fixed my problem.
Brandon Harper
February 5th, 2008
Google led me here, you’re number one for this error! Thanks a lot!
Kolja
February 5th, 2008
Really thx!
Dzs
February 6th, 2008
Thanks for posting this!
Chris
February 7th, 2008
Thank you sir!
Works… phew… Back to rails now… :D
Raju
February 10th, 2008
Thanks… That Worked
Frank
February 11th, 2008
You have resolved my problem.
Really thank you.
Riccardo Solimena
February 12th, 2008
Nice!
Thank you.
Kosh
February 15th, 2008
tkstkstks!
fotanus
February 15th, 2008
great — very helpful — good work
tim
February 24th, 2008
Nice. Worked for me. Thanks.
Marcus
February 24th, 2008
Thanks a lot – got things working again
Tyler
February 28th, 2008
excellent. cheers for post
Andy GOUNDRY
March 8th, 2008
10x a lot, found you by google :)
Portal
March 9th, 2008
Thanks for this – happy again.
UK Credit Fraud
March 10th, 2008
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
March 14th, 2008
Thanks! … my system was broken.
Todd
March 18th, 2008
Works on SuSE 10.3 and you’re still 1st hit on Google. Thanks for posting the fix.
James
March 20th, 2008
Thanks! Google got me here too. Easy fix saved much time.
Ken Weiner
April 6th, 2008
THANK YOU!
brittany
April 10th, 2008
thanks! that helps!!
zain alabdin tawfiq
April 13th, 2008
Great Fix!! Thanks!
rugger
April 21st, 2008
works! thanks a lot for the help.
Omar Bohsali
April 22nd, 2008
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
April 27th, 2008
All these great comments should make you feel wanted :) Thanks for sharing your knowledge.
philz
May 12th, 2008
Great post. Many thanks !
Rob
May 14th, 2008
thanks
spark
May 18th, 2008
Works on Ubuntu Hardy Heron. Thanks!
Paul
May 24th, 2008
thanks, saved my life.
daniel
June 6th, 2008
Thanks!
Ben
June 10th, 2008
For the One Millionth Time – Thanks!
pRick
June 15th, 2008
Thanks man.
Dr. Scotty Delicious, DFPA
July 3rd, 2008
This fixed the gems NameError for me after upgrading to XCode 3.0 in OS 10.5. Thank you!
Katherine Doubek
July 9th, 2008
still relevant in Kubuntu Hardy Heron – thanks!
jdzzle
July 17th, 2008
thanks! It really helps us newbies when kind folks in the know post their trials and solutions..
bronius
July 18th, 2008
Thanks a lot!
Manu
July 22nd, 2008
Thanks!
Heinz
July 23rd, 2008
worked on ubuntu 8.04 (hardy)
lucas luky
August 2nd, 2008
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
August 6th, 2008
Thanks! This was just what I was looking for. Finally i can run my app on debian!
Sam
August 17th, 2008
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
August 22nd, 2008
Thanks for the post, came up first in google for me.
Thanks Simon as well. Both solutions worked for me in Hardy.
Aaron Junod
September 1st, 2008
Thanks
Juo100
September 6th, 2008
fix0rD!
R0R
September 6th, 2008
Like the othoer ones: Really THANKS!
cvielma
September 11th, 2008
this is grrrreat!
me
September 12th, 2008
Awesome. That did the trick. Worked perfectly for Hardy – 8.04.1
redconfetti
September 14th, 2008
thanks zach for the n00b info!!
em
September 16th, 2008
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
September 17th, 2008
Thanks dude keep it up ..
Mayank Jain
September 18th, 2008
Thanks you
Abdul Basit
September 24th, 2008
Thanks. you are very very smart
buyanbat
October 9th, 2008
You rock
Mercurious
October 19th, 2008
greattttttttttttttttttttttt
fabio
October 21st, 2008
Thanks both Nick and Simon, worked nicely on Ubuntu 7.10.
maafy6
October 28th, 2008
Also worked with Debian Etch
DSidious
November 3rd, 2008
Hey,
for me the ‘rubygems/gem_runner’ its there but m still getting the error, any idea?
Rechae
November 7th, 2008
Thanks! it worked.
Spalis
November 7th, 2008
thanks for the fix this problem was starting to really get on my nerves :)
Yorkshire Terrier
November 23rd, 2008
I already have the line rubygems/gem_runner also, but still getting the error.
Any ideas?
me2
November 26th, 2008
Simon’s comment on August 22nd, 2008 worked for me
jDeppen
December 3rd, 2008
Thanks, still helpful today :-)
Achim
April 15th, 2009
Thanks a bunch! Worked like a charm.
PEZ
May 1st, 2009