How to fix “active developer path does not exist” with git on macOS

I’ve recently removed Xcode from my ageing MacBook. Ever since then, I’m getting an error when I try to run git from the command line. The error goes something like this:

That’s because Xcode had installed several command line tools provided by Apple, and one of them was Git. I thought simply installing it via Homebrew would do the trick but alas that too brings up an error message, albeit a different one. Somewhat frustrated, I was wondering how I was ever going to run Git from the command line again.

I did some testing and found a fix to this issue. Here’s what worked for me.

Turns out that I had a symbolic link (or rather a stub) at /usr/bin/git, a place at which git might indeed be expected to live. This however redirected to a no longer existent Xcode installation, or more precisely the xcrun command. All I had to do was rename the symbolic link with admin privileges:

Once that was taken care of, I could download the macOS installer from the official Git-SCM website. I found it under Downloads (it’s not the GUI version, just the command line version at the top of the page). It’s a .pkg file that will install git to /usr/local/git, and places symlinks into /usr/local/bin and /usr/share/man/.

Lo and behold, after the quick and painless installation, I could simply type git from the command line and the above error was gone, and git was operational again.

About Jay Versluis

Jay is a medical miracle known as a Super Survivor. He runs two YouTube channels, five websites and several podcast feeds. To see what else he's up to, and to support him on his mission to make the world a better place, check out his Patreon Campaign.

Add your voice!