$PATH in MacOSX 10.7
MacOSX has a truly global path setting that precedes any other setting like
/private/etc/paths is a list of pathnames. The order from top to bottom defines the resulting order in the
/private/etc/paths there is a directory
/private/etc/paths.d/ with files in the same style. Those are appended to the $PATH variable.
The default content of
/private/etc/paths looks like this:
/usr/bin /bin /usr/sbin /sbin /usr/local/bin
The resulting $PATH variable looks like this:
$ echo "$PATH" # => "/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin"
When using homebrew in its standard way, all your packages end up in
This is a problem if you want to install software via homebrew that should replace system default installations.
Git is a good example.
The system default
$ /usr/bin/git --version outputs
git version 22.214.171.124.
Your homebrew installed git (at the time of writing)
$ /usr/local/bin/git --version outputs
git version 126.96.36.199.
But without changing the default path combination, you end up using system Git instead of homebrew Git.
Correcting $PATH globally
There is various workarounds and fixes for this problem.
For example one could tackle this problem for a specific application. TextMate for example allows you to set
TM_GIT to a git executable of your choice. But why bothering with application specific settings, when you can fix the problem at its root.
I propose that
/usr/local/bin comes before
Here are the contents of my corrected
/private/etc/paths. I've moved
/usr/local/bin on top.
/usr/local/bin /usr/bin /bin /usr/sbin /sbin