Check versions and dependencies
Run xcodebuild -version and xcode-select -p. In Xcode settings, check the selected command line tools and confirm the SDK and deployment target your project requires.
If your project uses CocoaPods, Swift Package Manager, or another dependency manager, restore dependencies according to the project instructions. Don't upgrade every tool at once in response to an error.