What to do when Git commands fail on a Mac with invalid active developer error
If you are usingĀ a Mac, and trying to run any Git commands results in an error like:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools),
missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
On OS X, Git and many other command line tools need to be installed as part of the optional Command Line Tools subsection of the Xcode IDE. The Command Line Tool package gives users many commonly used command-line tools, utilities, and compilers, including make, GCC, clang, perl, svn, git, size, strip, strings, libtool, cpp, what, etc.
Fortunately it’s very easy to install this package, and you don’t have to install Xcode first.
Just open a terminal window and type;
xcode-select --install