How to uninstall Git from the command shell?
Do not uninstall Apple-distributed Git. You can leave it as it is and run another version by having it in a directory earlier in PATH
environment variable.
The easiest way to install another version on OS X would be to use Homebrew packet manager.
After installing it, you can run:
brew install git
Homebrew (brew
) will take care of all dependencies and configure the latest Git version, however there is still a chance it will find a setting it cannot resolve automatically, so read what Homebrew says at the end.
Packages installed with brew
do not interfere with system-preinstalled packages.
It installs packages under /usr/local/Cellar
directory and puts executables in /usr/local/bin
, so you just have to keep it in PATH
variable in before /usr/bin
.
For people who installed git by following instructions on official Git homepage, and therefore have git
installed at /usr/local/bin/git
, run the uninstall script:
/usr/local/git/uninstall.sh
/usr/bin/git
, along with some other cmd tools, is just a jumper binary to a real binary comes with Xcode.app or 'Xcode Command Line Tools' (CLT). It is protected by SIP and you shouldn't delete it.
You might consider to remove Xcode.app or /Library/Developer/CommandLineTools/ .