# Rake dependency error

**URL:** <https://www.ruby-forum.com/t/rake-dependency-error/152615>\
**Category:** Rails\
**Created:** [November 5, 2008, 5:18pm UTC](https://www.ruby-forum.com/t/rake-dependency-error/152615 "2008-11-05T17:18:34Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jrochkind](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/779978/32.png) [@jrochkind](https://www.ruby-forum.com/u/jrochkind)\
**Post date:** [November 5, 2008, 5:18pm UTC](https://www.ruby-forum.com/t/rake-dependency-error/152615/1 "2008-11-05T17:18:34Z")

</div>

Rake no longer works for me at all. I think this is a result of having  
upgraded some gems (including the RubyGem system itself), but not  
others, some kind of dependency problem. (I actually didn’t mean to  
upgrade this stuff, but typed stuff into the wrong terminal window. Doh!  
Don’t think there’s any good way to ‘downgrade’ RubyGems itself?).

But now, every time I try to run rake, to do anything at all, I get:

[rochkind@app01 ~]$ rake -v  
/usr/bin/rake:17: undefined method `require\_gem’ for main:Object  
(NoMethodError)

Any ideas how I fix this?

Jonathan

---

<div class="post-metadata">

**Author:** ![jrochkind](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/779978/32.png) [@jrochkind](https://www.ruby-forum.com/u/jrochkind)\
**Post date:** [November 5, 2008, 5:20pm UTC](https://www.ruby-forum.com/t/rake-dependency-error/152615/2 "2008-11-05T17:20:38Z")

</div>

Hmm, actually, responding to my own question as soon as I posted it,  
uninstalling and then reinstalling the latest rake seems to have done  
it:

“sudo gem uninstall rake -v 0.8.3”

“sudo gem update rake”.

rake -v runs again, at least.

Still wondering if there’s any good way to ‘downgrade’ the RubyGems  
installation itself, that I accidentally upgraded with “gem update  
–system” before I was really ready to. All the individual gems I can  
uninstall versions I don’t want (or use other solutions to have my  
applications using the versions I want), but the RubyGems system itself,  
once I upgraded accidentally with --system, there seems to be no good  
way to go back?

Jonathan

Jonathan R. wrote:

> Rake no longer works for me at all. I think this is a result of having  
> upgraded some gems (including the RubyGem system itself), but not  
> others, some kind of dependency problem. (I actually didn’t mean to  
> upgrade this stuff, but typed stuff into the wrong terminal window. Doh!  
> Don’t think there’s any good way to ‘downgrade’ RubyGems itself?).
> 
> But now, every time I try to run rake, to do anything at all, I get:
> 
> [rochkind@app01 ~]$ rake -v  
> /usr/bin/rake:17: undefined method `require\_gem’ for main:Object  
> (NoMethodError)
> 
> Any ideas how I fix this?
> 
> Jonathan

---

<div class="post-metadata">

**Author:** ![jrochkind](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/779978/32.png) [@jrochkind](https://www.ruby-forum.com/u/jrochkind)\
**Post date:** [January 5, 2010, 7:11am UTC](https://www.ruby-forum.com/t/rake-dependency-error/152615/3 "2010-01-05T07:11:23Z")

</div>

Your solution didn’t work for me. Even after uninstalling all versions  
of rake and reinstalling. rake -v still doesn’t run.

> “sudo gem uninstall rake -v 0.8.3”
> 
> “sudo gem update rake”.
> 
> rake -v runs again, at least.
> 
> Still wondering if there’s any good way to ‘downgrade’ the RubyGems  
> installation itself, that I accidentally upgraded with “gem update  
> –system” before I was really ready to. All the individual gems I can  
> uninstall versions I don’t want (or use other solutions to have my  
> applications using the versions I want), but the RubyGems system itself,  
> once I upgraded accidentally with --system, there seems to be no good  
> way to go back?
> 
> Jonathan

---

<div class="post-metadata">

**Author:** ![jrochkind](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/779978/32.png) [@jrochkind](https://www.ruby-forum.com/u/jrochkind)\
**Post date:** [January 5, 2010, 7:27am UTC](https://www.ruby-forum.com/t/rake-dependency-error/152615/4 "2010-01-05T07:27:19Z")

</div>

I fixed the problem by going into /usr/bin/rake  
and changing line 17 to just gem instead of require\_gem

```
  1 #!/usr/bin/ruby
  2 #
  3 # This file was generated by RubyGems.
  4 #
  5 # The application 'rake' is installed as part of a gem, and
  6 # this file is here to facilitate running it.
  7 #
  8
  9 require 'rubygems'
 10 version = "> 0"
 11 if ARGV.size > 0 && ARGV[0][0]==95 && ARGV[0][-1]==95
 12 if Gem::Version.correct?(ARGV[0][1..-2])
 13 version = ARGV[0][1..-2]
 14 ARGV.shift
 15 end
 16 end
 17 gem 'rake', version
 18 load 'rake'
```
