Skip to content

Instantly share code, notes, and snippets.

@saeedseyfi
Forked from brandonsimpson/reinstall_git_brew.md
Last active June 20, 2018 10:15
Show Gist options
  • Save saeedseyfi/9b01577c1f51baf89f219d1cdcea72c0 to your computer and use it in GitHub Desktop.
Save saeedseyfi/9b01577c1f51baf89f219d1cdcea72c0 to your computer and use it in GitHub Desktop.
Re-installing Git on Mac OSX with Brew

Re-installing Git on Mac OSX with Brew

This is helpful if you've previously installed git from source on OSX, and other compilers can't find the correct path. You need to remove the current version of git, then re-install with brew.

Uninstall git if installed manually

  1. Check which git you're running:
which git

output should be similar to this: /usr/bin/git

  1. Remove that git install
sudo rm -rf /usr/bin/git/ # If you got `Not permitted` error, you need to temporarily disable System Integrity Protection. https://goo.gl/6ynsCY
sudo rm /etc/paths.d/git # If doesn't exist, it's ok
sudo rm /etc/manpaths.d/git # If doesn't exist, it's ok
sudo pkgutil --forget --pkgs=GitOSX\.Installer\.git[A-Za-z0-9]*\.[a-z]*.pkg # If got error, it's ok

Re-install git with brew

brew uninstall git
brew update
brew install git

Check which git you're now running:

which git

Should now say: /usr/local/bin/git

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment