Last Updated: February 25, 2016
· ArondeParon

Change order of $PATH entries in OSX for Homebrew: the elegant way to do it

If you use Homebrew on a vanilla install of OSX, you have probably seen this error when using brew doctor:

Warning: /usr/bin occurs before /usr/local/bin
This means that system-provided programs will be used instead of those
provided by Homebrew. The following tools exist at both paths:


The error pretty much speaks for itself.

The most obvious solution is to simple alter your .profile or .bash_rl with something like this:

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

That works, but it would essentially add /usr/local/bin to your path twice, which is not really elegant.

It is good to know that OSX builds it's default $PATH from the file /etc/paths, which contains one entry on each line and is read in that exact order. You'll find /usr/local/bin listed in it as well; placing it on the first line in that file will solve the problem.

Say Thanks