5

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?

  • 2
    You probably need to (re?)install XCode command-line tools. This might help: https://www.freecodecamp.org/news/install-xcode-command-line-tools/ – tromgy Nov 01 '21 at 10:35
  • You can try this solution https://stackoverflow.com/a/64619274/10621865 . – Faisal Afroz Nov 02 '21 at 22:34

3 Answers3

9

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.

pors
  • 3,856
  • 36
  • 33
2

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
1

trying to learn python :

I cant install python on my mac ,some error when installing , tried donwloding all version for mac , still same error :https://www.python.org/downloads/macos/

when debuggong in VS Code : manually-specify-an-interpreter

https://code.visualstudio.com/docs/python/environments#_manually-specify-an-interpreter

tried to install an interpreter , failed

checked installed version on my mac , only found a path in xcrun: error: invalid active developer path, problem after zsh update for flutter

this worked out

xcode-select --install

This helps me fixing

Fedor
  • 17,146
  • 13
  • 40
  • 131
paulvill76
  • 11
  • 2