Following this OSX Sierra tutorial from the folks at gorails, I am having trouble getting rbenv global to associate the install of 2.3.0 with the ruby
command and to override the default ruby version on my MacBook Air with macOS Sierra v10.12.2
$ rbenv -v
rbenv 1.1.0
$ rbenv install 2.3.0
/Users/user_name/.rbenv/versions/2.3.0 installed
$ rbenv global 2.3.0
$ ruby -v
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]
I tried rbenv rehash
but ruby2.0.0 is still the default version. Briefly reviewing this blog about ruby and $PATH environment, I find I'm a little lost as to where the default Ruby "executable" actually lives…
gem env shows me that Ruby 2.0.0 lives here:
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
and whereis
tells me something different:
$ whereis ruby
/usr/bin/ruby
The tutorial says to add rbenv to my .bash_profile
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile source ~/.bash_profile`
Do I need to set my path to ignore the default ruby?
For what it is worth:
$ rbenv exec ruby -v
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin16]
but obviously I don't want to write out the executive command everytime I want to use ruby… Per the blog, adding eval "$(rbenv init -)"
doesn't make the ruby
command defer to the rbenv global version… Help.
Best Answer
I entered this:
but it should be:
...now it works fine.