My OS X comes with a version of Git installed in /usr/bin
. However, this version is older than the official stable one. I would like to upgrade it.
Can I use Homebrew to upgrade this version? Or would Homebrew install Git in a separate location (and if I do so, how can I ensure that the new version is actually used)?
Best Answer
Don't replace, modify or rename the system tools in /usr/bin. There are a number of reasons why this is a bad thing, and you can search for the specific reasons, but to be simple, don't edit the system versions.
Homebrew knows this, and that's why it stores the tools in /usr/local/bin. This version is used instead of the system version since Homebrew requests that its directory be before the system path in the $PATH variable.
Run
brew doctor
and you'll probably get a message like this:To fix this, either add this to your profile:
…or add
/usr/local/bin
to the top of /etc/paths, such as: