Skip to content

Instantly share code, notes, and snippets.

@brandonsimpson
Last active November 21, 2023 09:45
Show Gist options
  • Star 48 You must be signed in to star a gist
  • Fork 10 You must be signed in to fork a gist
  • Save brandonsimpson/54d9e085c9fde5e6ad3a to your computer and use it in GitHub Desktop.
Save brandonsimpson/54d9e085c9fde5e6ad3a 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

  2. Remove that git install

    sudo rm -rf /usr/bin/git/
    sudo rm /etc/paths.d/git
    sudo rm /etc/manpaths.d/git
    sudo pkgutil --forget --pkgs=GitOSX\.Installer\.git[A-Za-z0-9]*\.[a-z]*.pkg
    
    
    

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

@nnat157
Copy link

nnat157 commented Nov 21, 2023

Hey people! I was able to get this issue resolved. However i had to install manually (not using brew initially).

I followed the steps from the Git website to reinstall Git. https://git-scm.com/book/en/v2/Getting-Started-Installing-Git It automatically updated the git version i had on my Mac. Having XCode on my device did not effect the install. I know this may seem broad, but it worked for me!! hope this helps!

Thank you so much!! This absolutely worked for me!

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