To submit an iOS build to TestFlight without a local Mac, rent one, archive with xcodebuild, export an IPA, and upload it with Fastlane pilot and an App Store Connect API key. Connect over SSH or remote desktop and run every command below in Terminal. The commands have not been executed end to end in this guide, so run each against your own project and check its exit status.
What does a TestFlight upload need?
Assemble these pieces on the rented Mac before any script runs:
- Apple Developer Program membership. Free accounts cannot upload to TestFlight. The membership and the signing you do on the rented Mac are separate from the hosting plan.
- A distribution signing identity. The certificate is useless without its private key. Export them together on your original Mac as a passphrase-protected
.p12, transfer it to the rented Mac, import it once withsecurity import ... -k ~/Library/Keychains/login.keychain-db, then delete the.p12from disk. The identity now lives in the keychain, not in the file. - A matching provisioning profile file. Profiles are files, not keychain items. Install them under
~/Library/MobileDevice/Provisioning Profiles/<UUID>.mobileprovision. - An App Store Connect app record with your final bundle ID registered under the correct team.
- An App Store Connect API key (
.p8plus key ID and issuer ID). Both Apple's direct upload flow and Fastlane pilot accept it.
External beta testing adds App Review. Per Apple's TestFlight page, you must supply a beta app description, beta app review information and a monitored feedback email. Your first external build is sent to App Review automatically, and external testers can be invited only after that build is approved.
Which Xcode version do I need on the Mac?
Use an Xcode that Apple still accepts for uploads, and check the version before you rent. Apple's porting guide tells Intel users to run Xcode 26 or earlier, and Xcode 27 requires Apple silicon. Intel Xcode can still cross-compile arm64 device apps and universal macOS binaries, so an Intel host can submit builds on the Xcode 26 line.
On Figment, the Intel Mac VM runs macOS Sequoia, which fits Xcode 26.3 or earlier. Xcode 26.4 and later need macOS Tahoe 26.2 or later, and Xcode 27 needs Tahoe 26.6 or later, so those need an Apple silicon plan. Compare the macOS version shown before purchase with Apple's Xcode requirements table.
How do I archive, export and upload with Fastlane pilot?
Apple's Distributing your app for beta testing and releases documents the archive, distribute and upload path that Xcode Organizer uses. From a terminal the same endpoint is driven more cleanly through Fastlane's pilot (alias upload_to_testflight), whose api_key_path and ipa parameters are listed in the action reference.
First, save this pre-flight checker as scripts/testflight-preflight.sh and run it before any archive. It reports what is present and does not try to fix anything:
#!/usr/bin/env bash
set -euo pipefail
printf '%-26s %s\n' 'xcodebuild:' "$(xcodebuild -version | head -n1)"
printf '%-26s %s\n' 'fastlane:' "$(bundle exec fastlane --version 2>/dev/null | tail -n1)"
printf '%-26s %d\n' 'profiles installed:' \
"$(ls -1 ~/Library/MobileDevice/Provisioning\ Profiles 2>/dev/null | wc -l)"
printf '%-26s %d\n' 'distribution certs:' \
"$(security find-identity -v -p codesigning | grep -c 'Apple Distribution')"
printf '%-26s %s\n' 'ASC key JSON present:' \
"$([ -r "${ASC_KEY_JSON:-config/asc_api_key.json}" ] && echo yes || echo no)"
printf '%-26s %s\n' 'scheme env var:' "${MY_SCHEME:-UNSET}"
A zero on any count means fixing that prerequisite first. Local xcodebuild -exportArchive -help on Xcode 16.4 lists the current method values: app-store-connect, release-testing, enterprise, debugging, developer-id, mac-application, validation. The old app-store, ad-hoc and development names are deprecated aliases. Confirm with the installed binary on your rented Mac before you hardcode one.
Then run the archive, export and upload:
#!/usr/bin/env bash
set -euo pipefail
: "${MY_SCHEME:?set MY_SCHEME to your release scheme}"
: "${TEAM_ID:?set TEAM_ID to your 10-character Apple team id}"
xcodebuild archive \
-workspace MyApp.xcworkspace \
-scheme "$MY_SCHEME" \
-destination "generic/platform=iOS" \
-archivePath "$HOME/Archives/MyApp.xcarchive" \
| tee archive.log
test "${PIPESTATUS[0]}" -eq 0 || { echo "archive failed"; exit 1; }
cat > ExportOptions.plist <<PLIST
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0"><dict>
<key>method</key> <string>app-store-connect</string>
<key>teamID</key> <string>${TEAM_ID}</string>
<key>uploadSymbols</key> <true/>
</dict></plist>
PLIST
xcodebuild -exportArchive \
-archivePath "$HOME/Archives/MyApp.xcarchive" \
-exportPath "$HOME/Export/MyApp" \
-exportOptionsPlist ExportOptions.plist
IPA=$(find "$HOME/Export/MyApp" -maxdepth 1 -name '*.ipa' | head -n1)
[ -n "$IPA" ] || { echo "no IPA produced"; exit 1; }
bundle exec fastlane pilot upload \
--api_key_path "${ASC_KEY_JSON:-config/asc_api_key.json}" \
--ipa "$IPA" \
--skip_waiting_for_build_processing true
The explicit PIPESTATUS check stops a successful tee from masking an xcodebuild failure, so a failed archive is never reported as a submission. pilot upload is documented in Fastlane's upload_to_testflight reference, with api_key_path, ipa and skip_waiting_for_build_processing as the parameters used here. Bump CFBundleVersion before every retry, because App Store Connect rejects duplicate build numbers.
When the upload finishes, open your app in App Store Connect, then TestFlight, then Builds. The row moves from Processing to Ready to Submit within a few minutes. Any warning cites the exact Info.plist key, entitlement or encryption-export answer to fix before the next upload.
How do I keep the API key off disk and out of shell history?
The asc_api_key.json file holds the key ID, issuer ID and the base64-encoded .p8 payload. Handle it as a credential:
- Store the JSON in your CI secret manager (GitHub Actions encrypted secrets, Buildkite secrets, Bitrise generic file storage). Write it at job start with
umask 077set before writing, and registertrap 'rm -f "$ASC_KEY_JSON"' EXIT INT TERMso a clean exit removes the file. A trap cannot clean up after a hard kill or machine failure. If a job dies mid-run, rotate the key in App Store Connect rather than relying on the trap. - If you must keep a long-lived copy on the rented Mac, write it with
install -m 600into a path only your user can read, and rotate the key in App Store Connect whenever a teammate's access ends. - Do not run
env > .envon the rented Mac. It captures every unrelated token in the shell and puts them in a file that anything else on the machine can read later. Move only the names you need, and let their values come back from the secret manager at job time.
The signing .p12 is a separate artifact: certificate plus private key, exported with a passphrase. Carry the passphrase through the same secret manager, delete the .p12 after security import succeeds, and keep the provisioning profile file beside it only until it is installed under ~/Library/MobileDevice/Provisioning Profiles/.
To allowlist outbound traffic for App Store Connect, update your firewall, artifact store or CI runner egress. Apple does not publish a stable ingress range for App Store Connect, so there is nothing fixed to pin from the other side.
Which Figment Mac plan fits TestFlight submissions?
For an Xcode 26.3 or earlier project, the Intel Mac VM ($25 a month, $2 a day) is enough to archive, sign and upload. It runs macOS Sequoia and cannot run Xcode 26.4 or later or arm64-only tools. For a newer Xcode, use the Apple Silicon Mac VM ($39 a month, $6 a day). For a persistent pipeline, remember that we do not run CI for you and a persistent disk is not a backup, so keep signing material in your own secret manager. See all Mac hosting plans.
Related guides:
- AddressSanitizer on a remote Mac: catch memory bugs before TestFlight crash reports do.
- ThreadSanitizer on a remote Xcode: the race-detector companion.
- GitHub Actions self-hosted runner on a rented Mac: put the whole pipeline behind a
git push.