Mac OS: xcrun: error: invalid active developer path
While watching one of the Microsoft Build 2021 sessions, I ran into the following error message while trying to clone a project from Github using the git clone command line on my Mac. The entire error message is below:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Thankfully, the fix for this is pretty straightforward, install the Xcode toolkit! I had done this before, but for some reason, I had to do it again, and only after doing this, my git commands started to work while executing them in the terminal.
To install the Xcode toolkit, use the following command in your Mac OS terminal:
xcode-select --install
If that doesn’t work, try the following:
sudo xcode-select --install
And if that also doesn’t work, you can try the following next:
sudo xcode-select --reset
If the command line options above don’t work for you, you can download the Xcode toolkit manually from Apple’s Developer download page.