xcodebuild reference

Build an iOS Simulator App with xcodebuild

Use a clear xcodebuild command for an app that runs in iOS Simulator.

5 minute read
01

Run the command

Run xcodebuild from the repository root. Replace the workspace and scheme with the names from your project.

xcodebuild   -workspace MyApp.xcworkspace   -scheme MyApp   -configuration Debug   -sdk iphonesimulator   -destination 'generic/platform=iOS Simulator'   -derivedDataPath build/DerivedData   CODE_SIGNING_ALLOWED=NO   build
02

Find the .app

For this example, look in build/DerivedData/Build/Products/Debug-iphonesimulator. Use the folder for the configuration you chose.

If you use a project instead of a workspace, replace -workspace with -project and the .xcodeproj name.

03

Choose Debug or Release

Debug is a good default for day-to-day review. Use Release when the feature depends on its settings or optimizations.

Keep the choice in the workflow so the team can review changes to it.

Next: Use this .app in SimPreview

COMMON QUESTIONS

What teams ask

Why not build an .ipa?

An .ipa is for a device. SimPreview needs an app built for iOS Simulator.

Why use a generic destination?

It keeps the CI build from depending on one named Simulator.

Where should I set the configuration?

Set it in the CI workflow beside the scheme.

ADD IT TO A PULL REQUEST

Turn this build into a Simulator preview.

Use the same scheme and configuration in your SimPreview step.

Read the workflow guide