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

Ruby Installing a Ruby Development Environment Installing a Ruby Development Environment Installing Ruby on Mac

Cannot get OS X to use my rbenv installed ruby version

After using "rbenv install 2.3.0", I successfully installed 2.3.0

Then I used "rbenv global 2.3.0"

now when I use "ruby -v" the terminal returns

ruby 2.0.0p645 (2015-04-13 revision 50299) [universal.x86_64-darwin15]

So the ruby version I get from terminal is not the same i installed with rbenv. Is there anything I'm missing? How do I get ruby -v to return the version that I installed with rbenv?

3 Answers

In case anyone revisits this question, I resolved this by typing this exact line into the command line:

export PATH="$HOME/.rbenv/shims:$PATH"

then ruby -v will then return 2.3.0 (or whatever version you installed). But I have to retype it every time I start a new session.

Mike Ulvila
Mike Ulvila
16,268 Points

I added that PATH to my .zshrc file and it now stays on current version of Ruby. If you're not using zsh you could try pasting it into your .bash_profile.

You either need to reload your shell (just open a new one), or update your PATH. Walk through the rbenv setup instructions again.

Thanks for answering Nate. Obviously I am very new to this, so what would it mean to update the PATH? When I copy and paste the step 2 line, it doesn't seem to really do anything (the terminal does not return anything and ruby -v still returns 2.0.0).

Can you give me an example of how to permanently change the PATH to the .rbenv installed version of ruby?

Charles Cloud
Charles Cloud
6,134 Points

I think the issue has to do with the version of OSX. I am using 10.10.5 and I think the ~/.bash_profile has been changed for this version onwards. Can anyone confirm this?

Charles Cloud
Charles Cloud
6,134 Points

The command is executing but I am still getting the original version from OSX...