Removing git from /usr/bin
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.
Related videos on Youtube
Till
I am a senior web developer with 18 years experience, who loves the web, dancing, power-lifting and hugging trees. I specialize in full-stack Laravel development, big data, performance optimization, web standards, accessibility and user-friendly design. My personal goal is to make the web a better place, by creating secure, ultra-fast, high quality websites for anyone who is passionate about their product, service or idea.
Updated on September 18, 2022Comments
-
Till over 1 year
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
-
slhck almost 12 yearsI'm afraid Homebrew won't work with
sudo
– there's no need to run it with root permissions anyway. -
echristopherson almost 12 yearsThe presence of git in /usr/bin points to it being a non-Homebrew installation.