Use `sudo xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools, or use `xcode-select --install` to install the standalone command line developer tools. code example

Example 1: active developer path ("/Applications/Xcode.app/Contents/Developer") does not exist

sudo xcode-select --reset

Example 2: xcrun: error: invalid active developer path (/Applications/Xcode.app/Contents/Developer),

$ sudo xcode-select -r
$ sudo xcode-select --switch /Library/Developer/CommandLineTools