xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
This is the error I get in VS Code's terminal. There are error squiggles under the "#include <stdio.h>" line.
This is after I upgraded to Mac OS Monterey.
What is the reason for this error and what is the solution?
When upgrading your Mac OS, sometimes the code command-line tools stop working. This can be resolved by running this in the terminal:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
If you don't have Xcode installed you should do:
xcode-select --install
which will install the command-line tools without having Xcode.
The fix, luckily, is pretty straight forward. Install the Xcode toolkit! Even if you had it installed before, you might have to re-register it or update it to the latest version.
$ xcode-select --install
If that doesn’t work, force it to reset. You’ll need sudo access for this one.
$ sudo xcode-select --reset
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With