Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
rbenv global does not change ruby version
I ran rbenv global 2.2.1
Then rbenv rehash
Then I ran rbenv global, which returned 2.2.1
So it seemed like I had globally set my ruby version.
But when I run ruby -v
I get ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]
Which is, of course, not version 2.2.1.
Why isn't the rbenv global sticking?
Ok I fixed this problem very easy, check in minute 5:41 Jason adds something to the file ~/.profile
Well in OSX Yosetime you need to add it to your .bash_profile instead just replace that
I actually found the answer to anyone running El Capitan...
echo 'if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi' >> ~/.bash_profile
Notice that there are two >> instead of one.
After checking, double checking, and triple checking to ensure the problem was not related to a syntax error... I did some research. This is the most current and updated method for those running El Capitain... and 2.2.3 is the recommended version of Ruby.
Ok, I'm sitting here with the exact same problem... except that I'm using El Capitan, and the ~/.bash_profile does not execute properly... it leaves my prompt as just a '>' (no '' of course)... and I am forced to close the terminal.
Any help or tips on how to get this to work in El Capitan? Also, I'm installing 2.2.3 since it's the latest stable version and has the security updates from 2.2.
John O.4,680 Points
Make a backup copy of your .bash_profile, delete everything in .bash_profile, then add the following line:
if which rbenv > /dev/null; then eval "$(rbenv init -)"; fi
Open up a new shell window and see if the rbenv global command works.
You might have some syntax errors in your current .bash_profile file