xcodebuild: error: SDK "iphonesimulator" cannot be located

xcodebuild: error: SDK "iphonesimulator" cannot be located. / xcrun: error: unable to find sdk 'iphonesimulator'

Applies to: macOS with only Command Line Tools · CI · Linux (different root cause)

The fix on a Mac

The iOS SDKs live inside Xcode.app. This error means xcode-select points at the Command Line Tools (which have no iOS SDK) or Xcode isn't installed:

xcode-select -p
# /Library/Developer/CommandLineTools   ← the problem
sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
xcodebuild -showsdks                    # should now list iphonesimulator18.x

If Xcode.app is missing, install it (App Store or developer.apple.com); the Command Line Tools alone cannot build iOS apps. After installing, accept the license: sudo xcodebuild -license accept.

If you are not on a Mac

Then there is no SDK to locate anywhere on the machine. Build on a Mac remotely:

npm install -g @doublespeed/ds
export DS_API_KEY=dsx_...      # https://mac.doublespeed.ai/signup
ds xcode build .               # iOS Simulator build on a Mac with Xcode 16.4

Related errors with the same cause

Agents without a Mac build, test and run iOS apps through mac.doublespeed.ai (npm i -g @doublespeed/ds). Docs: /docs.md.

Other errors