Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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?

git
git-cvsserver
git-receive-pack
git-shell
git-upload-archive
git-upload-pack
gitk
share|improve this question
add comment

3 Answers 3

up vote 8 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
add comment

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
add comment

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
add comment

Your Answer

 
discard

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.