I'm trying to install Ruby 1.9 using Homebrew. I'm using Mac OS X Lion, so Ruby 1.8.7 is installed by default.

I've got Homebrew installed at /usr/local/bin/brew (well that's what it says if I run 'which brew')

It seems to be using the Ruby located in /usr/bin/ruby (again, from 'which ruby')

I've read tons of suggestions saying I should do something to the path variable; mine looks like this:


Where am I going wrong? Why is the Homebrew version of Ruby not being used?

2 Answers 2


Bash checks all folders in $PATH for the first one containing the application you're looking for.

In some file (~/.profile, ~/.bashrc, ~/.bash_profilewill be a line adding/usr/local/bin` to your $PATH. It will look like this:

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

Change the order to

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

Now, the operating system will look into /usr/local/bin/ and use ruby from homebrew instead the system's native one.

  • I didn't actually have a line like you specified, but I added PATH=/usr/local/bin:$PATH as the first line in ~/.profile and that fixed it! Thanks Nov 4, 2011 at 0:19

If you plan to use ruby , consider the use of Rvm (or rbenv) Rvm home page


brew update 
\curl -sSL https://get.rvm.io | bash -s stable

Follow instructions in prompts (you'll need to source some scripts ) something like "source ~/.rvm/scripts/..."

rvm list  # this list all rubies instaled 
rvm use 2.3.1  # this set env on ruby version you want to use 

This way you'll have an entire ecosytem with ruby gems by version according to ruby's version . Like :


Then all dependencies are met and everything goes smoothly you can switch ruby version at any time with rvm use 2.x All version of rubies will be home based and installable with rvm withch is a great tool if you want use ruby regulary. If you want use the framework (Rails) it's installable by appending --rails to the prvious curl command like so :

\curl -sSL https://get.rvm.io | bash -s stable --rails

Default's sytem version on mac is a weird(and very old) one , consider also use 2.x version ;)

  • Ok i've edited the thing ;)
    – plombix
    Jun 3, 2016 at 11:39

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .