Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm on OS X 10.8 and I'm using Homebrew. brew doctor tells me that I have 2 git installations, one in /usr/bin and the other one in /usr/local/bin.

Is it a bad idea to remove git from /usr/bin? If no, what's the best way to remove git and the following components from /usr/bin to only use Homebrew's?

share|improve this question
up vote 11 down vote accepted

What's the best way to remove git and the following components from /usr/bin to only use Homebrew's?

Your shell uses the non-Homebrew binaries only because they come first in your $PATH.

So, in your ~/.bash_profile (or ~/.profile, depending on which you use), add the following line:

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

Remove all other PATH assignments that would put /usr/local/bin after $PATH, because then, /usr/bin would come first, and your shell would use the system git.

You could remove the Git installations in /usr/bin, but it's up to which one to choose. I believe at some point you used the git-osx-installer, which put it there, but there's no problem keeping both installations. You just have to know which one you want to use.

share|improve this answer
Great, thank you! – Till Jul 28 '12 at 16:54

Apply common sense and ask yourself WHY do you want one install removed? Do you want to invoke one of those two gits everytime? Just have its bin directory in PATH first.

share|improve this answer

The best way is to remove it using Homebrew, because it has the record that your git was installed. If you remove it manually, during some repair process, it could install it again.

With following command check what files git package is using:

brew info --all git

Or all the files with dependencies:

brew ls --unbrewed git

The the simple way is to remove it by:

brew remove git

But it's up to you. If the git was installed by different package manager, try that one which you installed with (like port, etc.).

share|improve this answer
I'm afraid Homebrew won't work with sudo – there's no need to run it with root permissions anyway. – slhck Jul 28 '12 at 16:50
The presence of git in /usr/bin points to it being a non-Homebrew installation. – echristopherson Jul 28 '12 at 23:45
I'm using brew with sudo, but it depends of your configuration. – kenorb Jul 29 '12 at 0:31

Because of the "/usr/bin/git" is installed by apple git-48, so I prefer DO NOT change the PATH. You could do something like following:

$ brew update
$ brew install
$ sudo mv /usr/bin/git /usr/bin/git-48

Then you can check it by

$ git --version

The output will be like this: git version 2.1.0

BTW, if you want to install vim by homebrew, it also works.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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