Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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:

/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/opt/local/bin:/usr/local/bin/brew

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

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

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.

share|improve this answer
    
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 –  Jaco Pretorius Nov 4 '11 at 0:19
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.