Solve warning "was built for newer macOS version" - XCode

If you ever got a warning like this:

ld: warning: dylib (/Applications/Xcode.app/Contents/PlugIns/IDESwiftPackageCore.framework/Versions/A/Frameworks/SwiftPM.framework/SharedSupport/ManifestAPI/libPackageDescription.dylib) was built for newer macOS version (11.0) than being linked (10.15)

I'm with you, it can be quite puzzling, but the answer to fix this is super simple. Follow the steps below:

  1. Open your terminal
  2. Set the path to your XCode correctly:
  3. sudo xcode-select --switch /Applications/Xcode.app

That's all 😜