I installed rbenv according to the github directions. I am running OSX but I have tried this on a Ubuntu 12.04 VM and got the same results. The following is what i get in my terminal when I try to change ruby versions:
rbenv versions
* 1.9.3-p0 (set by /Users/user/.rbenv/version)
1.9.3-p125
rbenv global
1.9.3-p0
rbenv rehash
ruby -v
ruby 1.8.7 (2011-12-28 patchlevel 357) [universal-darwin11.0]
which ruby
/usr/bin/ruby
Anyone have any ideas as to why rbenv isn't switching the ruby version like it thinks it is? Also there is no .rbenv file in the local directory that would be causing the ruby version to default to 1.8.7
rbenv local
rbenv: no local version configured for this directory
Best Answer
Check that PATH contains
$HOME/.rbenv/shims
and$HOME/.rbenv/bin
Also check that you have the following in your ~/.bash_profile if using bash or ~/.zshenv if using zsh
NOTE: Make sure it's the last setting in your ~/.bash_profile . I ran into an issue where I installed a program that updated my .bash_profile and reset PATH.
Finally, make sure your
$HOME
folder doesn't have a.ruby-version
file that you may have created by accident if you were to have done$ rbenv local <ruby-version>
in your$HOME
folder. Doing$ rbenv global <ruby-version>
modifies the$HOME/.rbenv/version
file, and the existence of a.ruby-version
file in the$HOME
folder would override the version set by$HOME/.rbenv/version
.From the docs: