Trying to set up Homebrew on a new Mac (on previous Macs I would install packages from source).

The first package I tried to install was Git:

$ brew install git

Installation went OK, but which git still shows the one in /usr/bin/git that came along with Lion (I think?). And not the one in /usr/local/bin/git that was just installed.

$ echo $PATH
/Users/meltemi/.rvm/gems/ruby-1.9.2-p290@rails31/bin:/Users/meltemi/.rvm/gems/ruby-1.9.2-p290@global/bin:/Users/meltemi/.rvm/rubies/ruby-1.9.2-p290/bin:/Users/michael/.rvm/bin:/usr/local/mysql/bin:/opt/subversion/bin:/Developer/Additions/checker/:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

As you can see /usr/bin defaults to before /usr/local/bin in the $PATH

So, I'm confused! I thought the point of HomeBrew (and something the creators seem to brag about) was that you don't have to mess with the $PATH variable!?!

So, what did I do wrong?

link|improve this question

did you mess with your path previously and maybe put them in the wrong order? Also Im not sure why this is a "bragging point" form homebrew... it not like the concept of a path or modifying it is a complex thing which involves authoring and sprinkling 10 different plists across your system with special permissions or something.... – prodigitalson Aug 17 '11 at 19:43
path, well the part that isn't RVM related, should be standard issue. And no, I'm not complaining about having to change the path. It's just that they seem to repeat the claim If you choose /usr/local, everything 'just works!' that I have to wonder what I'm missing...because it doesn't "just work". – Meltemi Aug 17 '11 at 19:50
feedback

migrated from stackoverflow.com Aug 18 '11 at 1:16

This question came from our site for professional and enthusiast programmers.

1 Answer

You haven't done anything wrong, but it does seem pretty clear that if you had /usr/local/bin in your path before /usr/bin this specific problem would go away. The easiest fix is to do just that and put something like

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

in your .bashrc or .bash_profile so everything that Homebrew installs is found first. That's the way that I have it set up on my Mac, and it has worked for me for this long, however, YMMV.

Edit

It does appear that they believe it would work with /usr/local/bin being after /usr/bin, so while I might have mucked up my own $PATH, I can see where their documentation lacks:

Note that you should put /usr/local/bin after /usr/bin because some programs will expect to get the system version of eg. ruby, and break if they get the newer Homebrew version.

From the section on My GUI .apps don’t find /usr/local/bin utilities!

link|improve this answer
Won't this leave two /usr/local/bins in my $PATH? I believe so. I wonder if we should instead be editing the order of the default paths in /etc/paths or the contents of /etc/paths.d? But this will affect every user...maybe not a bad thing. Anyway, just wanted to see how other people have approached this. – Meltemi Aug 17 '11 at 19:58
@Meltemi, the spirit of this answer is correct: update your PATH (in the manner of your choosing) to have /usr/local/bin precede /usr/bin. I personally update my PATH in .bash_profile as suggested here. – shelhamer Aug 17 '11 at 20:21
@Nick- interesting information...and only serves to confuse matters (at least my matters)...Homebrew docs seem to imply that Terminal commands should pick up apps in /usr/local/bin even though it trails /usr/bin in the path. But GUI apps need special coddling? IT would seem all apps, GUI or not, need us to adjust the $PATH variable. So, what am I (or the Homebrew creators) missing? – Meltemi Aug 18 '11 at 0:44
I think Homebrew assumes you want to use the Apple supplied executable first - git is a change as until Lion it was not supplied by Apple thus Homebrew needed it - now you can use the Apple one, – Mark Aug 18 '11 at 12:27
I agree with Mark on this. With MacPorts and Fink, the assumption was to provide a completely pristine, separate environment from anything Apple supplied out of the box. Homebrew took the stance that Apple's stuff is great and not to avoid using it (why download another version of gcc when Apple's will likely do?). – Nick Klauer Aug 18 '11 at 19:13
show 1 more comment
feedback

Your Answer

 
or
required, but never shown

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