/usr/bin/gem:23:uninitialized constant Gem::GemRunner(NameError)

I came across this error when I tried to update my RubyGems because my Rails wanted version 1.3.1 and I was having 1.2.0.

When I wrote  “sudo gem update –system” on the terminal I came across the following error :

/usr/bin/gem:23: uninitialized constant Gem::GemRunner(NameError)

So the solution is to add require ‘rubygems/gem_runner’ line to  /usr/bin/gem . If you don’t know how to do this or if you are a newbie, don’t  worry, I am explaining it below .

Step 1 : Go to the terminal and type the following

$ cd /usr/bin/

This will move you to the folder  /usr/bin/

Step 2 : Type the following command to open up file in text editor

$ sudo pico gem    and enter your password

Step 3 : Add the line ‘rubygems/gem_runner’ to the gem file that opens up after Step 2 ,

Add the line before  require ‘rubygems’
Step 4 : Press Ctrl+X to save the file and exit

4a) Press ‘Y’ if you think you have done the relevant changes correctly and want to save the file. Otherwise,

Press ‘N’ and move out without saving.

4b) If you press ‘Y’ in the previous step, it will ask you if you want to save the file with same name? , Just

press ‘Enter’ and move out.

I hope this solution will help you to solve your problem. I was successful in solving my problem on my Ubuntu 8.04.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s