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

**URL:** <https://rubytalk.org/t/rake-aborted-undefined-method-gem-for-main-object/35228>\
**Category:** ruby-talk\
**Created:** [9 February 2007 21:55 UTC](https://rubytalk.org/t/rake-aborted-undefined-method-gem-for-main-object/35228 "2007-02-09T21:55:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![peppermonkey1](https://avatars.discourse-cdn.com/v4/letter/p/e5b9ba/32.png) [@peppermonkey1](https://rubytalk.org/u/peppermonkey1)\
**Post date:** [9 February 2007 21:55 UTC](https://rubytalk.org/t/rake-aborted-undefined-method-gem-for-main-object/35228/1 "2007-02-09T21:55:07Z")

</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:** ![peppermonkey1](https://avatars.discourse-cdn.com/v4/letter/p/e5b9ba/32.png) [@peppermonkey1](https://rubytalk.org/u/peppermonkey1)\
**Post date:** [9 February 2007 22:20 UTC](https://rubytalk.org/t/rake-aborted-undefined-method-gem-for-main-object/35228/2 "2007-02-09T22:20:10Z")

</div>

seems the problem is not just with rake.  
doing a

ruby script/generate model \<insert name\>

gives the following:

./script/../config/boot.rb:29: undefined method `gem' for main:Object  
(NoMethodError)  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;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:** ![John\_Wilger1](https://avatars.discourse-cdn.com/v4/letter/j/8e8cbc/32.png) [@John\_Wilger1](https://rubytalk.org/u/John_Wilger1)\
**Post date:** [9 February 2007 22:40 UTC](https://rubytalk.org/t/rake-aborted-undefined-method-gem-for-main-object/35228/3 "2007-02-09T22:40:06Z")

</div>

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

> **···**
>
> On Feb 9, 1:49 pm, "peppermonkey" \<peppermon...@moose-mail.com\> wrote:
> 
> > 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
> 
> --  
> Regards,
> 
> John Wilger

---

<div class="post-metadata">

**Author:** ![John\_Wilger1](https://avatars.discourse-cdn.com/v4/letter/j/8e8cbc/32.png) [@John\_Wilger1](https://rubytalk.org/u/John_Wilger1)\
**Post date:** [9 February 2007 22:45 UTC](https://rubytalk.org/t/rake-aborted-undefined-method-gem-for-main-object/35228/4 "2007-02-09T22:45:09Z")

</div>

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

> **···**
>
> On Feb 9, 2:39 pm, "John Wilger" \<johnwil...@gmail.com\> wrote:
> 
> > You need to update to the latest version of Rake, I believe.

---

<div class="post-metadata">

**Author:** ![peppermonkey1](https://avatars.discourse-cdn.com/v4/letter/p/e5b9ba/32.png) [@peppermonkey1](https://rubytalk.org/u/peppermonkey1)\
**Post date:** [9 February 2007 22:50 UTC](https://rubytalk.org/t/rake-aborted-undefined-method-gem-for-main-object/35228/5 "2007-02-09T22:50:06Z")

</div>

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

> **···**
>
> On Feb 9, 5:42 pm, "John Wilger" \<johnwil...@gmail.com\> wrote:
> 
> > On Feb 9, 2:39 pm, "John Wilger" \<johnwil...@gmail.com\> 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`
