Undefined method ‘task’ using Rake 0.9.0

As explained in mordaroso’s answer, there is a problem in Rake 0.9.0. You need to temporarily downgrade Rake in order to avoid it:

  1. run: gem uninstall rake -v 0.9 (add sudo unless you use rvm)

  2. add to your Gemfile: gem 'rake', '~> 0.8.7'

  3. and then run: bundle update

You can skip the first step, but then you have to run rake using bundle exec, for example:

bundle exec rake db:migrate

Otherwise you get the following error.

rake aborted!
You have already activated rake 0.9.0, but your Gemfile requires rake 0.8.7. Consider using bundle exec.

Update

As Alex Chaffee noticed in a comment for Pablo Cantero’s answer, that you might need to do the following to uninstall Rake if you still see the problem

rvm use @global && gem uninstall rake -v 0.9.0
rvm use @       && gem uninstall rake -v 0.9.0

Also try the solution suggested in Duke’s answer.

Leave a Comment