MacOS: Git error: xcrun invalid active developer path

03-15-2021

Recently I tried to run the git branch command on a local repository. While it worked just the other day, now I’m receiving this error:

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

The problem: I recently updated my OS and things are a bit out of sync.

The solution: Install the Xcode Toolkit

1
xcode-select --install

If this does not work, you may need to download Xcode manually from the Apple Developer Downloads site.