Help center › Mobile app development

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.

Related

Install Xcode and simulatorsSign in with your own Apple Account, install Xcode, accept the licence, add simulators.Set up your Mac for iOS developmentThe order to do things in: connect, Xcode, your Apple Account, GitHub, then your first build.Testing on a real iPhone or iPadDevices can’t be cabled to our Macs; use simulators here and TestFlight for real hardware.

Still stuck?

Signed-in customers can message us from the portal; we reply within 24 hours on business days (AEST).