RubyGems: An Error, A Solution

Feb 17, 2007

So the other day I was trying to get a brand spankin’ new Rails app up and running, and upon trying to use anything script/generate or rake related I kept getting this error:

undefined method `gem' for main:Object (NoMethodError)

Ouch. That hurts. Anyway, after some investigation I learned two things.

  1. Google, through harnessing the collective intelligence of the internet, knows every answer.
  2. I needed to update RubyGems itself.

So in the future if you run into a similar error message just pop open the command line and type:

sudo gem update --system

That will update RubyGems for you and hopefully send you on your merry way back to your coding efforts.