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 ex
bundle exec
is correct, but you don't want to be typing it every time.
You can put this in your .bashrc:
# Automatically invoke bundler for rake, if necessary.
rake() { if [ -e ./Gemfile.lock ]; then bundle exec rake "$@"; else /usr/bin/env rake "$@"; fi; }
Last time that this happened to me, I had updated all my gems. I did a gem uninstall rake
and it listed version options. I picked the newer one, and then I did not have to use bundle exec
anymore.
Basically, if you use bundle exec
it uses whatever gem version is in installed by your bundle, so what is in the Gemfile. Without bundle exec
it uses whatever version is your system default.