Reputation: 189
I am unable to uninstall Git from my Mac. I am running macOS Sierra. I have tried all solutions available, but can't seem to figure out how to uninstall Git from my Mac.
Here is the screenshot of the current version of Git installed on my Mac.
Thanks.
Upvotes: 18
Views: 32630
Reputation: 86
First -
brew install git
Then edit the /etc/paths and add /opt/homebrew/bin/ right below /usr/local/bin. Worked on my M3 MAX with Sonoma, without requiring to remove Apple Git.
Upvotes: 0
Reputation: 443
Hacky way to solve this, add alias git=/usr/local/bin/git
to ~/.zshrc
Upvotes: -1
Reputation: 338835
I am no expert, but for me on a Mac running macOS 13.2.1 Ventura…
/usr/local/bin/git
It seems that /usr/local/bin/git
is user installed. In a terminal, type which git
to see if you have this. This git can be uninstalled. I found shortcuts there. I context-clicked on one to find original.
By digging into the orignial folders I found a uninstall.sh
. Drag that to a Terminal.app window, and hit Return to execute. The script confirms your desire to uninstall git
. Proceed, wait a moment, and Poof!. Gone.
Now run which git
again. In my experience, it switch to now reporting a different installation of git: /usr/bin/git
.
/usr/bin/git
In contrast, /usr/bin/git
seems to be installed by Apple and cannot (or apparently, should not) be removed.
This purge enabled my IntelliJ IDE to successfully install Git so that I might access GitHub from within an IDE project.
Before the purge, IntelliJ reported errors after trying to install Git for its own use.
Upvotes: -1
Reputation: 9
To remove all components of git from MAC
$ cd /usr/local/bin
$ sudo rm -rf git*
Upvotes: -1
Reputation: 490
brew install git
then
PATH=/usr/local/git/bin:$PATH
the new git version will replace apple git as default
Upvotes: 24
Reputation: 1589
I had the exact same problem today. I wanted to use the latest git version as default instead of Apple Git. After a couple of hours, here is what helped me -
/usr/local/git/bin/git
Backup Apple Git binary to some location (just in case)
$ sudo cp /Applications/Xcode.app/Contents/Developer/usr/bin/git /tmp/git-apple
Overwrite system's git with above downloaded git binary
$ sudo cp /usr/local/git/bin/git /Applications/Xcode.app/Contents/Developer/usr/bin/git
Verify the git version now -
$ git --version
Hope this helps others as well.
Upvotes: 2
Reputation: 98435
There's nothing for you to do. The git you refer to is a part of the operating system. It's not user-installable. You do not want to un-install it.
If you want a different version, install it using e.g MacPorts or homebrew and use port select git
or brew link
, respectively, to choose the preferred version.
Upvotes: 10