CodePrairie .NET

South Dakota .NET User Group


undefined method 'gem' for main:Object

I have to do development on several different machines (keeping them in sync is a real pain, so if you have any good advice please share) and when I went to do some rails work I kept getting this error everytime I'd try to do something:

undefined method `gem' for main:Object

It took me a little while to figure out, but I finally upgraded ruby gems

gem update --system

and things started working again.

Published May 28 2007, 08:07 AM by chrisortman
Filed under: ,



Chas conquest said:

I've been bonking all morning trying to get a new app up with mongrel. That did the trick! Thanks so much!

June 5, 2007 8:47 AM

Travis said:

Hey, that did the trick for me too. Thanks!

June 9, 2007 4:45 PM

Dave said:

Worked, thanks

June 13, 2007 7:20 PM

Chris said:

Me too, thanks bunches.

June 16, 2007 2:13 PM

Casey said:

Sweet and simple solution. Thanks!

June 17, 2007 1:24 AM

Brian McQuay said:

Good call. I just ran into this myself and though wtf! Luckily you solved it already for me. Thanks brotha. Seems odd that you're on a .net blog writing about rails. Whatever.

June 18, 2007 5:49 PM

krister said:

did you ever happen to find any good solutions to the synchronization problem? i'd love to hear it if so.

June 19, 2007 10:57 PM

Frick said:

Fixed my problem as well.

June 20, 2007 10:41 AM

Machine said:

I love you, that fixed my problem as well.. BTW if yo uhave gentoo don't emerge rails, use (gem install rails)  will fix your problems

June 22, 2007 5:05 PM

Adam C said:

thanks for the tip, was driving me crazy!!

June 22, 2007 5:31 PM

Jaime said:

kudos. Working for me on freebsd :D

June 26, 2007 8:38 PM

jojo said:

Great worked for me too!

July 3, 2007 3:47 PM

kay said:

fixed one of my problems - on to the next!

July 11, 2007 6:53 AM

Joe said:

Oh! Yes, thanks! Fixed for me too!

Why didn't I think to search the web 3 hours ago?!!

July 13, 2007 9:40 AM

jsanti said:

Great man! Thanks for the tip!

July 16, 2007 12:46 PM

Stuart Blair said:

Thanks! That was driving me crazy.

August 1, 2007 2:25 PM

Ryan Warner said:

Thanks!  What lead you to try this solution?

August 7, 2007 9:49 AM

chrisortman said:

Coming from the windows world the 2 best fixes are usually reboot or reinstall, so I figured well gem is in the error message let's see what I can do to that. So

gem --help

OOO, gem help commands lists all commands

I looked at a few commands there and eventually saw the -- system arg for update and figured I'd give it a try.

August 10, 2007 5:58 AM

Justin Chen said:

Thanks!  That saved me a few more hours of head scratching.

August 14, 2007 3:37 PM

Chris Messina said:

Worked for me! Thanks!!

August 24, 2007 11:43 AM

Noel Proffitt said:

Thanks for posting that ruby gems tip!

August 25, 2007 12:10 PM

Mark said:

Champion! thanks for this, saves alot of pain!

August 28, 2007 6:05 AM

James DArling said:

Another thanks.

September 1, 2007 10:53 AM

James Darling said:

Another thanks.

September 1, 2007 10:54 AM

Eric said:

Thanks a lot! You saved me from a big headache

September 22, 2007 5:28 PM

onur said:

it works xD

November 11, 2007 1:19 AM

Erishen said:

Thanks very much!

Gem update --system Cool

December 4, 2007 7:40 AM

adi said:

thanks a lot...very helpful

July 21, 2008 1:15 AM

Jorge said:

Thanks from Mexico!!!

October 4, 2008 12:56 PM

teo said:


October 21, 2008 5:03 PM

Leave a Comment

Powered by Community Server (Commercial Edition), by Telligent Systems