Add a second Fastlane lane that uses platform=tvOS Simulator for tests, generic/platform=tvOS for the archive, a tvOS-specific provisioning profile and a separate ExportOptions-tvOS.plist with method=app-store, then pass app_platform: "appletvos" to pilot for the TestFlight upload. Apple TV support is an addition, not a rewrite: your signing certificate, Fastlane install and TestFlight account are reused. What changes is the destination specifier, the provisioning profile and one ExportOptions.plist value.
Which destination strings does xcodebuild need for tvOS?
Use tvOS Simulator (with a space) for tests and generic/platform=tvOS for the archive. xcodebuild uses destination specifiers to pick a platform and device, and Apple documents the key and value form in Technical Note TN2339.
Run tests in the Apple TV 4K simulator (set pipefail first so a failing test fails the pipe):
set -o pipefail
xcodebuild test \
-scheme "MyApp-tvOS" \
-destination "platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=latest" \
-derivedDataPath ./DerivedData \
| xcpretty
Archive for distribution (generic device, not a specific simulator):
set -o pipefail
xcodebuild archive \
-scheme "MyApp-tvOS" \
-destination "generic/platform=tvOS" \
-archivePath ./build/MyApp-tvOS.xcarchive \
| xcpretty
generic/platform=tvOS builds a device binary suitable for App Store submission. A named simulator destination produces a simulator binary that cannot be submitted.
Replace MyApp-tvOS with your project's shared scheme name. To list the simulators Xcode currently knows about on your Mac:
xcrun simctl list devices --json | python3 -c "
import json, sys
data = json.load(sys.stdin)
for runtime, devices in data['devices'].items():
if 'tvOS' in runtime:
for d in devices:
print(runtime, '|', d['name'], '|', d['udid'])
"
The exact simulator names depend on the Xcode version installed, so use whatever the command prints.
How do I configure the Xcode project for tvOS?
Confirm these before you write CI steps:
- A tvOS app target exists (not just the iOS target with Designed for iPad enabled).
- The tvOS target has its own bundle identifier (for example
com.example.myapp.tvos). - Shared frameworks list tvOS as a supported platform in their target settings.
- iOS-only APIs are wrapped in
#if !os(tvOS)conditional compilation blocks. - The tvOS scheme is shared (Product → Scheme → Manage Schemes → Shared).
- A tvOS app icon set is present in the asset catalog (separate from iOS).
- A tvOS App Store distribution provisioning profile is created in the developer portal.
A tvOS scheme must be shared to be visible to xcodebuild and Fastlane in a headless CI environment. Unshared schemes live under a user-specific directory and are not committed.
How do tvOS provisioning profiles differ from iOS?
tvOS distribution uses separate provisioning profiles from iOS, even when the certificate is the same:
| Item | iOS | tvOS |
|---|---|---|
| App ID | com.example.myapp | com.example.myapp.tvos |
| Provisioning profile | MyApp iOS Distribution | MyApp tvOS Distribution |
| Distribution certificate | App Distribution (shared) | App Distribution (same cert) |
| ExportOptions method | app-store | app-store |
| ExportOptions bundle map | iOS bundle ID → iOS profile | tvOS bundle ID → tvOS profile |
Create the tvOS profile in the developer portal: Certificates, Identifiers & Profiles → Profiles → (+) → App Store Distribution → select the tvOS App ID. Apple's Distributing your app for beta testing and releases covers the end-to-end flow.
What does the tvos_beta Fastfile lane look like?
Add this lane to your existing Fastfile. It assumes your iOS lane already handles certificate setup with match; the tvOS lane reuses the same match storage with a tvOS profile type.
# Fastfile
lane :tvos_beta do |options|
# 1. Ensure certificates and the tvOS profile are up to date
match(
type: "appstore",
app_identifier: "com.example.myapp.tvos",
platform: "tvos"
)
# 2. Run unit tests in the Apple TV 4K simulator
scan(
scheme: "MyApp-tvOS",
destination: "platform=tvOS Simulator,name=Apple TV 4K (3rd generation),OS=latest",
output_directory: "./test-results/tvos",
output_types: "junit",
fail_build: true
)
# 3. Build and archive for App Store distribution
gym(
scheme: "MyApp-tvOS",
destination: "generic/platform=tvOS",
configuration: "Release",
archive_path: "./build/MyApp-tvOS.xcarchive",
output_directory: "./build",
output_name: "MyApp-tvOS",
export_method: "app-store",
export_options: "ExportOptions-tvOS.plist"
)
# 4. Upload to TestFlight — pass app_platform explicitly for tvOS.
pilot(
ipa: "./build/MyApp-tvOS.ipa",
app_platform: "appletvos",
skip_waiting_for_build_processing: true,
changelog: options[:changelog] || "New tvOS build from CI"
)
end
The scan step uses fail_build: true, so if any test fails the lane stops and later steps never run. The pilot action's app_platform option is documented in the Fastlane pilot action reference; pass appletvos explicitly instead of relying on auto-detection when a project ships multiple platforms. Invoke the lane with:
bundle exec fastlane tvos_beta changelog:"Fixes #452 tvOS crash on launch"
What does ExportOptions.plist look like for tvOS?
<?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</string>
<key>teamID</key>
<string>YOUR_TEAM_ID</string>
<key>provisioningProfiles</key>
<dict>
<key>com.example.myapp.tvos</key>
<string>MyApp tvOS Distribution</string>
</dict>
<key>signingStyle</key>
<string>manual</string>
<key>stripSwiftSymbols</key>
<true/>
</dict>
</plist>
Replace YOUR_TEAM_ID with your 10-character Apple Developer Team ID. The provisioningProfiles dictionary maps the tvOS bundle ID to the exact profile name as it appears in the developer portal. This file contains only identifiers and no secrets, so you can commit it.
How do I run tvOS tests headlessly?
The CI Mac needs the tvOS platform runtime installed. Check it:
xcrun simctl list runtimes | grep tvOS
If a required runtime shows as unavailable, Xcode 15 and later can download it from the command line:
xcodebuild -downloadPlatform tvOS
Run this once after provisioning a new Mac and confirm the runtime shows available before you wire the pipeline. Keep fail_build: true on scan, because a green pipeline over failing tests is worse than no pipeline.
Which Figment Mac plan fits tvOS CI?
Use the Apple Silicon Mac VM ($0.40 an hour, $6 a day, $39 a month) for current Xcode, since Xcode 26.4 or later needs macOS Tahoe 26.2 or later and Xcode 27 needs Tahoe 26.6 or later. Each tvOS simulator runtime takes roughly 5–8 GB of disk, so for several runtimes or Xcode versions the Dedicated M4 Pro 48 GB ($349 a month, or $299 a month on a 12-month term, 512GB SSD) has more room than the VM's 65GB. The Intel Mac VM ($25 a month, 80GB SSD) runs macOS Sequoia and fits many tvOS targets only while Xcode 26.3 or earlier is enough; it cannot run arm64-only binaries or visionOS. Check the macOS version shown before purchase against Apple's Xcode release notes to confirm the Xcode and macOS pair you need.
How does that compare with other hosts on price?
Entry monthly prices for a single CI runner, with other vendors' figures as published on their own pages:
| Option | Price | What's quoted | Source |
|---|---|---|---|
| Figment Intel Mac VM | $25/month ($2 a day) | 4 shared vCPUs, 4GB RAM, 80GB SSD, macOS Sequoia | figment.so/mac-hosting |
| Figment Apple Silicon Mac VM | $39/month ($6 a day) | 4 shared vCPUs, 4GB RAM, 65GB SSD | figment.so/mac-hosting |
| Figment Dedicated M4 Pro 48 GB | $349/month ($299 on a 12-month term) | Whole Mac: M4 Pro, 48GB RAM, 512GB SSD | figment.so/mac-hosting |
| CloudMac monthly | $99.99/month | M4, 16 GB RAM, 256 GB SSD | cloudmac.org/pricing |
| CloudMac annual | $999/year ($83.25/month effective) | M4, 16 GB RAM, 256 GB SSD | cloudmac.org |
| MacStadium M4.S | $149/month | M4, 16 GB RAM, 256 GB SSD; support and 99.99% uptime claim on page | macstadium.com/pricing |
Over twelve months: 12 × $25 = $300, 12 × $39 = $468, $3,228 paid up front for the Dedicated M4 Pro 48 GB, 12 × $99.99 = $1,199.88, $999 for the CloudMac annual term and 12 × $149 = $1,788 for MacStadium. The Apple Silicon Mac VM costs $531 less than the CloudMac annual rate ($999 − $468), but it has 4GB RAM and 65GB of disk against 16 GB and 256 GB, and its vCPUs are shared. CloudMac's larger-disk rows currently show "Fully reserved" with no next allocation date on the pricing page, so ask about 256 GB availability. Figment runs the Mac; you manage Xcode, Fastlane and the CI configuration, and we do not offer managed CI.