This problem happens when
xcode-select developer directory was pointing to
/Library/Developer/CommandLineTools when a full regular Xcode was required (happens when CommandLineTools are installed after Xcode)
- Install Xcode (get it from https://appstore.com/mac/apple/xcode) if you don’t have it yet.
- Accept the Terms and Conditions.
- Ensure Xcode app is in the
xcode-selectto the Xcode app Developer directory using the following command:
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
Note: Make sure your Xcode app path is correct.