I'm on Mac OS Sierra. I ran the following:
brew install rbenv ruby-build
# Add rbenv to bash so that it loads every time you open a terminal
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
source ~/.bash_profile
# Install Ruby
rbenv install 2.3.1
rbenv global 2.3.1
ruby -v
But, the output of ruby -v is ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]
Can't figure out what went wrong. I tried to reinstall 2.3.1 and it said the version already existed. Ideas?
Open a new terminal window. Check echo $PATH. Does it include the directory ~/.rbenv/shims? If it doesn't, then check if you've added the rbenv init line to ~/.bash_profile, or to ~/.zshrc if you're running zsh.
When everything is setup correctly, which -a ruby should list ~/.rbenv/shims/ruby first (this is important), then /usr/bin/ruby (your system Ruby) second.
Perfect, that fixed is. Thanks!
Remember to close the issue after your problem has been answered 馃槈
when i installed for some reason it did not updated by bash_profile.
i cannot stress how important it is to:
Edit your ~/.bash_profile and put
eval "$(rbenv init -)"
at the end
Most helpful comment
Open a new terminal window. Check
echo $PATH. Does it include the directory~/.rbenv/shims? If it doesn't, then check if you've added therbenv initline to~/.bash_profile, or to~/.zshrcif you're running zsh.When everything is setup correctly,
which -a rubyshould list~/.rbenv/shims/rubyfirst (this is important), then/usr/bin/ruby(your system Ruby) second.