When running rake
I get this error:
You have already activated rake 0.9.2, but your Gemfile requires rake 0.8.7. Consider using bundle exec.
Using bundle exec rake
instead of just rake
seems to work, but is it the best way to fix this?
Using bundle exec
is the right way to do this.
Basically what's happening is that you've updated rake to 0.9.2 which now conflicts with the version specified in your Gemfile. Previously the latest version of rake
you had matched the version in your Gemfile, so you didn't get any warning when simply using rake
.
Yehuda Katz (one of the original Bundler developers) explains it all in this blog post.
To avoid typing bundle exec ...
all the time, you could set up an alias or function in your shell for commands you commonly use with Bundler. For example this is what I use for Rake:
$ type bake
bake is a function
bake ()
{
bundle exec rake "$@"
}