Rbenv is awesome. I find it the most simple solution to handle different Ruby versions. But if you use it with tons of other stuff like brew and heroku you have to take care in what order you set your paths to use everytime the right bins for loading your applications. Here is what I use in my .bash_profile:
export PATH="$HOME/.rbenv/bin:/usr/local/bin:/usr/local/sbin:/usr/local/heroku/bin:$PATH" eval "$(rbenv init -)" export PATH="./.bundle/bin:$PATH"
First add heroku, then add everything related to brew and then add everything
related to rbenv. After this, load rbenv and your currently selected Ruby
version. If you find gemsets useless like I do add the last line of the
example also. This will load all the binstubs in the current directory that you
can create with the
--binstubs option for bundler. To make it even more
convenient add this also to your .bash_profile:
alias bi='bundle --binstubs .bundle/bin'
Now you can bundle with binstubs by just typing "bi" and all gems and bins will load in the following order:
- project specific gems in the current folder
- ruby specific gems from with rbenv currently selected ruby version
- gems/bins installed with brew
- gems/bin installed in the system