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

Mathew Leland
Mathew Leland
17,940 Points

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

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

Mathew Leland
Mathew Leland
17,940 Points

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?

Mathew Leland
Mathew Leland
17,940 Points

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.

Brian Peterson
Brian Peterson
Python Web Development Techdegree Student 13,634 Points

Hi Mathew,

Thank you very much for this answer. It saved me quite a bit of frustration.

Sincerely, BP

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.

Charles Cloud
Charles Cloud
6,133 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,133 Points

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