Mac OS: xcrun error: invalid active developer path, missing xcrun

On my Mac, I suddenly ran into an error when I tried to update my oh-my-zsh. I have no idea why, as I haven’t changed any configuration lately. I’m running MacOS Big Sur version 11.2.3.

The error was:

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

Fortunately, there is an easy solution to that — just install, or reconfigure, the Xcode toolkit. You can either download it from the Appstore, from the Apple Developer download section, or you can install it via the Terminal:

$ xcode-select --install

If you already have it installed and need to reset it, you can do the following (you probably need sudo rights to do that):

$ sudo xcode-select --reset

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store