I originally posted at https://o9uz.dev/posts/macos-xcrun-error-invalid-active-developer-path-missing-xcrun
I ran into this error when I tried any brew operation (like brew update and brew upgrade) on a Mac. I had just upgraded to macOS Big Sur 11.1 and suddenly brew broke!
$ brew update
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools),
missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
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 even that fails, go to the https://developer.apple.com/download/more and download Xcode manually.
I am a computer engineer. Please visit my website for more details. I am here because I like to share my experiences in computer science and my coding life.