airbuild-xcode
Run xcodebuild install, archive or test inside an AirBuild build script, with AirBuild's defaults for configuration, destination, signing and caches.
airbuild-xcode calls xcodebuild once, with one action, and adds AirBuild’s defaults for whatever you did not pass. It exists only inside the scripts that runbuild, runtest and runmacos run (including scripts they call), on a cloud macOS builder or a Mac Team’s Mac. It is not installed anywhere else, and it is not on Linux builders.
Use it in place of xcodebuild for install, archive, test and -showBuildSettings. For any other Xcode operation, call xcodebuild directly.
Synopsis
airbuild-xcode install|archive|test|-showBuildSettings [xcodebuild options and build settings]
airbuild-xcode --helpThe action must come first. Every other argument is passed on to xcodebuild unchanged, and airbuild-xcode exits with xcodebuild’s exit code.
Actions
| Action | What it is for | Cache |
|---|---|---|
install |
The everyday build: xcodebuild install builds the scheme’s Archive targets into DSTROOT, incrementally. Put it in build.script. |
In a cloud build, the first install of the run brings back the Project’s DerivedData. |
archive |
The archive a signed .ipa or an unsigned device package is made from. Put it in release.script. |
None: an archive starts over every run. |
test |
Run tests. | In a cloud build, the first test of the run brings back the Project’s DerivedData (a copy separate from install’s). |
-showBuildSettings |
Print the build settings with the same defaults a build would get. | — |
Signed and device builds refuse install: they export an archive, so they run the release: recipe.
Defaults
install, archive and -showBuildSettings follow AIRBUILD_SIGN (default 0), which runbuild sets:
| Build | Configuration | Destination | Signing |
|---|---|---|---|
Ordinary (AIRBUILD_SIGN=0) |
Debug |
generic/platform=iOS Simulator |
CODE_SIGN_IDENTITY=-; the project’s other signing settings are kept |
Device package (AIRBUILD_SIGN=0, AIRBUILD_DEVICE=1): runbuild --unsigned or Install on Device without managed signing |
Release |
generic/platform=iOS |
Ad-hoc signed with the project’s entitlements, no team or profile. Simulator -destination and -sdk values are dropped. |
Signed (AIRBUILD_SIGN=1): runbuild --sign |
Release |
generic/platform=iOS |
Managed signing prepared by AirBuild |
test defaults to an iPhone simulator on the newest iOS runtime that has a regular (not foldable) iPhone, preferring one already booted, plus CODE_SIGN_IDENTITY=- and -collect-test-diagnostics never. It does not create simulators.
What you can override
- An explicit
-configuration,-destination(more than one for tests), and, for ordinary builds and tests,CODE_SIGN_IDENTITY=…replace the defaults. -collect-test-diagnostics on-failureturns simulator diagnostics back on fortest.ARCHS,COMPILATION_CACHE_*,SWIFT_ENABLE_PREFIX_MAPPINGandCLANG_ENABLE_PREFIX_MAPPINGon the command line win over the builder’s platform settings. On a builder, simulator and macOS builds are arm64 only unless you passARCHS.- Managed signing overrides the project’s,
-xcconfig’s and the command line’s signing settings:CODE_SIGNING_ALLOWED,CODE_SIGNING_REQUIRED,CODE_SIGN_IDENTITY,CODE_SIGN_STYLE,DEVELOPMENT_TEAM,PROVISIONING_PROFILE,PROVISIONING_PROFILE_SPECIFIERandOTHER_CODE_SIGN_FLAGS.CODE_SIGN_ENTITLEMENTSis kept.
Version numbers
A device or managed-signing archive that a person started from the AirBuild app is raised to the Project’s version floor: MARKETING_VERSION and CURRENT_PROJECT_VERSION are overridden only where the source says less. A build an Agent starts never is: set the build number in the project yourself.
Output
Before it runs xcodebuild, airbuild-xcode prints what it chose on standard error:
[airbuild-xcode] sign=0; configuration=Debug (default); destination=generic/platform=iOS\ Simulator (default).
[airbuild-xcode] CODE_SIGN_IDENTITY=default (-); project signing settings are preserved.[airbuild-xcode] default test device: iPhone 17 (iOS 26.1).
airbuild-xcode: skipping simulator diagnostics collection (simctl diagnose waits 600 s on Xcode 27); pass -collect-test-diagnostics on-failure to collect them.
[airbuild-xcode] action=test; destination=id=<UDID> (default); CODE_SIGN_IDENTITY=default (-).Other lines you may see:
| Line | Meaning |
|---|---|
[airbuild-xcode] archive starts over every run and keeps no cache; … |
An ordinary build is archiving. Use install in build: and keep archive in release: for incremental builds. runbuild repeats this as a warning by its result. |
[airbuild-xcode] device build: dropped -destination … |
A simulator destination or SDK was removed from a device build. |
[airbuild-xcode] device build: ad-hoc signed, no team or profile; CODE_SIGN_ENTITLEMENTS is preserved. |
A device package build. |
[airbuild-xcode] Managed signing overrides via XCODE_XCCONFIG_FILE: … |
A signed build. |
[airbuild-xcode] command-line ARCHS=… kept over the platform build settings. |
Your setting won over the builder’s. |
[airbuild-xcode] version floor: raised … / nothing raised. |
The version-floor step for a build started from the app. |
Exit codes and errors
airbuild-xcode exits with xcodebuild’s exit code. It stops with 64 before running xcodebuild when:
| Message | What to do |
|---|---|
airbuild-xcode: start with install, archive, test or -showBuildSettings; use xcodebuild directly for other operations. |
Put the action first, or call xcodebuild. |
airbuild-xcode: use one leading action; run other Xcode operations separately. |
Remove -list, -version, -show…, -exportArchive, -resolvePackageDependencies and the like; run them with xcodebuild. (-showBuildTimingSummary is allowed.) |
airbuild-xcode: -configuration requires a value. (or -destination) |
Give the value. |
airbuild-xcode: a signed or device build exports an archive; put airbuild-xcode archive in the release: recipe of airbuild.yaml … |
Add a release: recipe that runs airbuild-xcode archive. |
airbuild-xcode: no available iOS simulator could be selected. Install an iOS simulator runtime and device in Xcode, or pass -destination explicitly. |
Pass -destination, or install a simulator runtime. |
airbuild-xcode: AIRBUILD_SIGN must be 0 or 1. Start managed signing through AirBuild. |
Do not set AIRBUILD_SIGN yourself; use runbuild --sign. |
airbuild-xcode: signing preparation is incomplete. Start signing through AirBuild again. |
Run runbuild --sign again. |
Examples
# build.script: the everyday, incremental build
airbuild-xcode install -workspace App.xcworkspace -scheme App \
DSTROOT="$PWD/.airbuild/artifacts/install"# release.script: the archive for --sign and --unsigned
rm -rf .airbuild/artifacts/App.xcarchive
airbuild-xcode archive -workspace App.xcworkspace -scheme App \
-archivePath .airbuild/artifacts/App.xcarchive# A test entry, with runtest's --additional-options
airbuild-xcode test -workspace App.xcworkspace -scheme App \
-resultBundlePath .airbuild/artifacts/Tests.xcresult $additional_options