Build and test from the command line
xcodebuild and the simulator over SSH: list schemes, pick a simulator, build and run tests.
Everything Xcode does on the desktop can run over SSH with xcodebuild. From your project folder:
1. Find your scheme
xcodebuild -list -project MyApp.xcodeproj
# or, with CocoaPods or a workspace:
xcodebuild -list -workspace MyApp.xcworkspace
2. Pick a simulator
xcrun simctl list devices available
Use a device name from that list (for example iPhone 16) in the next step.
3. Build and test
xcodebuild test -scheme MyApp \
-destination 'platform=iOS Simulator,name=iPhone 16'
Use build instead of test to compile only. Add ,OS=latest (or a version such as OS=18.0) to the destination to pick an iOS version. Pass several -destination options to test on more than one simulator in one run.