# Rake aborted! undefined method \`gem' for main:Object

**URL:** <https://www.ruby-forum.com/t/rake-aborted-undefined-method-gem-for-main-object/102682>\
**Category:** Ruby\
**Created:** [February 9, 2007, 10:55pm UTC](https://www.ruby-forum.com/t/rake-aborted-undefined-method-gem-for-main-object/102682 "2007-02-09T22:55:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![peppermonkey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e56c9b/32.png) [@peppermonkey](https://www.ruby-forum.com/u/peppermonkey)\
**Post date:** [February 9, 2007, 10:55pm UTC](https://www.ruby-forum.com/t/rake-aborted-undefined-method-gem-for-main-object/102682/1 "2007-02-09T22:55:53Z")

</div>

Hi,  
there must be some configuration mistake but can someone help me out?  
I have ruby, gem, rails and such installed.  
version  
ruby: 1.8.4  
gem: 0.8.11  
rails 1.2.2

If I do a

rake rails:update

I get the following:

Rake aborted!  
undefined method `gem’ for main:Object

I get the same message when doing just  
rake

any ideas?  
Is there a problem with my path?

thanks in advance.

---

<div class="post-metadata">

**Author:** ![peppermonkey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e56c9b/32.png) [@peppermonkey](https://www.ruby-forum.com/u/peppermonkey)\
**Post date:** [February 9, 2007, 11:40pm UTC](https://www.ruby-forum.com/t/rake-aborted-undefined-method-gem-for-main-object/102682/2 "2007-02-09T23:40:58Z")

</div>

On Feb 9, 1:49 pm, “peppermonkey” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> Rake aborted!  
> undefined method `gem’ for main:Object

You need to update to the latest version of Rake, I believe.

–  
Regards,

John W.

---

<div class="post-metadata">

**Author:** ![peppermonkey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e56c9b/32.png) [@peppermonkey](https://www.ruby-forum.com/u/peppermonkey)\
**Post date:** [February 9, 2007, 11:45pm UTC](https://www.ruby-forum.com/t/rake-aborted-undefined-method-gem-for-main-object/102682/3 "2007-02-09T23:45:59Z")

</div>

On Feb 9, 2:39 pm, “John W.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> You need to update to the latest version of Rake, I believe.

Doh! I meant to say RubyGems. Update to the latest version of  
RubyGems. `gem update --system`

---

<div class="post-metadata">

**Author:** ![peppermonkey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e56c9b/32.png) [@peppermonkey](https://www.ruby-forum.com/u/peppermonkey)\
**Post date:** [February 9, 2007, 11:20pm UTC](https://www.ruby-forum.com/t/rake-aborted-undefined-method-gem-for-main-object/102682/4 "2007-02-09T23:20:56Z")

</div>

seems the problem is not just with rake.  
doing a

ruby script/generate model

gives the following:

./script/…/config/boot.rb:29: undefined method `gem’ for main:Object  
(NoMethodError)  
from script/generate:2

which looks to be the same problem.  
I know gem is installed and at least partially working as I can do a

gem update rails --include-dependencies

and ruby seems to be working as well.

Not sure why ruby can’t talk to gem (or at least that is what seems to  
be going on imo)

---

<div class="post-metadata">

**Author:** ![peppermonkey](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/p/e56c9b/32.png) [@peppermonkey](https://www.ruby-forum.com/u/peppermonkey)\
**Post date:** [February 9, 2007, 11:51pm UTC](https://www.ruby-forum.com/t/rake-aborted-undefined-method-gem-for-main-object/102682/5 "2007-02-09T23:51:00Z")

</div>

On Feb 9, 5:42 pm, “John W.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> On Feb 9, 2:39 pm, “John W.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:
> 
> > You need to update to the latest version of Rake, I believe.
> 
> Doh! I meant to say RubyGems. Update to the latest version of  
> RubyGems. `gem update --system`

Whoops. updated other stuff but forgot about updating gem’s itself.  
lol. Thanks! That did the trick 😃
