Tag Archives: brew

System-provided packages taking precedence over Homebrew-installed packages

If you are using a Mac, you must be familiar with Homebrew. After installing brew, you must run the following command to ensure it is ready to install packages.

brew doctor

When you install a package, e.g., git, that also comes pre-installed with Mac, you will notice that even though brew installed a newer version of that package, it is still the older version (the one provided by the system) that seems to be taking precedence.

Here is the reason why this happens:

Brew installs the packages into their own directories and symlinks the executables into /usr/local/bin. If you run brew doctor at this point, it clearly mentions what is happening behind the scenes:

Warning: /usr/bin occurs before /usr/local/bin This means that system-provided programs will be used instead of those provided by Homebrew. 
Consider amending your PATH so that /usr/local/bin is ahead of /usr/bin in your PATH.


Modify the sequence of paths in /etc/paths file so that /usr/local/bin comes ahead of /usr/bin.

sudo vi /etc/paths

Here is a sample /etc/paths file (after the change):


If you check the version of the installed package at this point, it would be the one installed by brew.