Lorenzo
Lorenzo

Reputation: 89

Ruby version not identified on Mac

I have just installed the latest Ruby version with HomeBrew, but I still get "ruby 2.0.0p481" from the terminal when I type "Ruby --version". I'm using a MacBook Air 10.9.5 (Mavericks). How do I fix this? It would be awesome if you could give me a step-by-step solution. Thanks!

Upvotes: 3

Views: 3026

Answers (3)

Mohanraj
Mohanraj

Reputation: 4200

Better to use some ruby environment management utilities any of specified here

I personally suggest you to use rbenv or rvm, it works very well with Mac-book.

Upvotes: 2

Navin Peiris
Navin Peiris

Reputation: 2596

This issue is quite probably that you're still using the ruby version that ships with MacOS (the one under /usr/bin/ruby) rather than the one installed by homebrew (which is under /usr/local/bin/ruby.

First, check which version you're actually using by executing the following command in the terminal:

which ruby

If this says /usr/bin/ruby instead of /usr/local/bin/ruby, you can add the following at the end of your .bashrc or .zshrc to allow the terminal to use the executables from /usr/local/bin over /usr/bin:

export PATH="/usr/local/bin:$PATH"

Now if you open a new terminal window, which ruby should point to the one installed by homebrew

Upvotes: 3

rochefort
rochefort

Reputation: 146

If you use zsh, try rehash. Otherwise I think $PATH is the cause. Check it out, echo $PATH | ruby -ne 'puts $_.split(":")'

Upvotes: 0

Related Questions