# Migrate from Xcode Cloud to a Self-Hosted Mac

Canonical: https://figment.so/blog/mac-xcode-cloud-migration-self-hosted

Map each Xcode Cloud action to xcodebuild or Fastlane, run both pipelines side by side for three builds, then switch. A $39 flat-rate Mac costs less than any paid Xcode Cloud tier once you pass the 25 included compute hours a month.

**To leave Xcode Cloud, rebuild each workflow action with `xcodebuild` and Fastlane on a Mac you control, run both pipelines side by side for at least three builds, then disable the Xcode Cloud workflow.** Apple's published paid tiers are US$49.99/month for 100 hours, US$99.99/month for 250 hours, US$399.99/month for 1,000 hours and US$3,999.99/month for 10,000 hours (see the [Xcode Cloud subscription page](https://developer.apple.com/xcode-cloud/)). A rented Mac is a flat monthly fee instead of a metered clock, and the $39 Apple Silicon Mac VM costs less than the $49.99 100-hour tier, so it starts to pay off once your builds regularly pass the 25 compute hours included with a developer membership.

References used throughout: Apple's [Xcode Cloud documentation](https://developer.apple.com/documentation/xcode/xcode-cloud) and [Configuring your first Xcode Cloud workflow](https://developer.apple.com/documentation/xcode/configuring-your-first-xcode-cloud-workflow).

## What does an Xcode Cloud workflow consist of?

Every workflow has five parts, and each needs a replacement:

1. **Start condition**: branch push, pull request, tag, schedule or manual run.
2. **Environment**: selected Xcode version, macOS image and environment variables.
3. **Build action**: compiles the project, and can run tests inline.
4. **Test action**: runs a chosen `.xctestplan` against simulator or device destinations.
5. **Post-actions**: TestFlight distribution, App Store submission, Slack or email notifications.

Workflows are configured in Xcode's Report navigator or in App Store Connect. There is no YAML file on disk, so migration is a deliberate mapping, not a file copy.

## How do Xcode Cloud actions map to a self-hosted Mac?

Mark each row done when the self-hosted command produces output that matches the Xcode Cloud build.

| Xcode Cloud action | Self-hosted equivalent | Notes |
|---|---|---|
| Start: branch push | CI webhook on push | GitHub Actions, Buildkite, GitLab CI, Jenkins |
| Start: pull request | CI pull_request trigger | Scope with `-only-testing:` for PR test subsets |
| Start: tag | CI tag trigger | Use for release builds |
| Start: schedule | CI cron trigger | Nightly builds, regression sweeps |
| Environment: Xcode version | `DEVELOPER_DIR` pointing at the installed Xcode bundle | See the sibling guide below on multiple Xcode versions |
| Build | `xcodebuild build -scheme … -destination …` or `fastlane gym` | `gym` wraps archive and export |
| Test (unit) | `xcodebuild test -scheme … -testPlan …` | Pass the committed `.xctestplan` path |
| Test (UI) | `xcodebuild test -scheme … -destination "platform=iOS Simulator,…"` | Destination must match an installed simulator |
| Archive | `xcodebuild archive -scheme … -archivePath …` | Required before export and upload |
| Export IPA | `xcodebuild -exportArchive -archivePath … -exportOptionsPlist …` or `gym` | Keep `exportOptionsPlist` in source control |
| Post: TestFlight | `fastlane upload_to_testflight` | Authenticate with an App Store Connect API key |
| Post: App Store | `fastlane upload_to_app_store` | Metadata upload is optional |
| Post: Slack | `fastlane slack` with webhook URL | Store `SLACK_URL` in CI secrets |
| Post: email | CI notification plugin on the runner | Most CI platforms ship a built-in email step |

## How do I replicate test plans?

Use the same `.xctestplan` files. Xcode Cloud reads the plans you pick in its UI, and `xcodebuild` reads the same files:

```bash
xcodebuild test \
  -workspace MyApp.xcworkspace \
  -scheme "$SCHEME" \
  -testPlan "$TEST_PLAN" \
  -destination "platform=iOS Simulator,name=iPhone 16,OS=18.0" \
  -resultBundlePath "$RUNNER_TEMP/TestResults.xcresult"
```

`$SCHEME` and `$TEST_PLAN` are your project's real values, so do not hard-code a scheme name that does not exist in the workspace. If the test plan is not yet in source control, export it from Xcode (Product → Test Plan → Export) and commit it before migration. Confirm destinations with:

```bash
xcrun simctl list devices available
```

A mismatched destination string is the most common reason a parity run diverges from Xcode Cloud.

## How do I re-create the post-actions in Fastlane?

The two post-actions most teams need are the TestFlight upload and the Slack notification.

```ruby
# fastlane/Fastfile
default_platform(:ios)

platform :ios do
  desc "Archive, upload to TestFlight, notify Slack"
  lane :beta do
    gym(
      scheme: ENV.fetch("SCHEME"),
      workspace: ENV.fetch("WORKSPACE"),
      export_method: "app-store",
      output_directory: ENV["RUNNER_TEMP"] || "./build",
      output_name: "MyApp.ipa"
    )

    upload_to_testflight(
      api_key_path: ENV.fetch("ASC_API_KEY_JSON"),
      skip_waiting_for_build_processing: true
    )

    slack(
      message: "TestFlight build uploaded",
      channel: "#ios-releases",
      slack_url: ENV.fetch("SLACK_WEBHOOK_URL")
    )
  end
end
```

The `api_key_path` value points at an App Store Connect API key JSON that Fastlane reads at runtime. Generate the `.p8` in App Store Connect under Users and Access → Integrations, then assemble the JSON per the [Fastlane App Store Connect API docs](https://docs.fastlane.tools/app-store-connect-api/). Keep the `.p8` and the JSON in your CI secret manager, never commit them, and never echo them into shell history. Store signing certificates as encrypted `.p12` files with the private key. Provisioning profiles are regular `.mobileprovision` files copied into `~/Library/MobileDevice/Provisioning Profiles/`. Neither is exported from Keychain by a CI step.

## How long should I run both pipelines in parallel?

Run them side by side for about three weeks and at least three real builds before you disable Xcode Cloud.

1. **Week 1.** Stand up the self-hosted runner, install the pinned Xcode, and run the lane manually against a feature branch. Compare IPA size, build number and test counts against the matching Xcode Cloud run.
2. **Week 2.** Trigger both pipelines on every push to `develop`. Diff the artifacts and the `.xcresult` summaries.
3. **Week 3.** Route the release branch only to the self-hosted pipeline. Leave the Xcode Cloud workflow enabled but idle.
4. **After one clean release.** Disable the Xcode Cloud workflow. Wait one billing cycle before deleting it so you can roll back.

Parallel operation costs both Xcode Cloud hours and the rented Mac for one or two weeks. That overlap is cheaper than a failed release caused by an undiscovered gap.

## What does Xcode Cloud cost compared with a rented Mac?

At 400 builds a month of 15 minutes each (100 compute hours), the Apple Silicon Mac VM costs about $0.10 a build and Xcode Cloud's 250-hour tier about $0.25. The worksheet below uses a moderate-volume team. Replace the numbers with yours.

- 20 builds/day x 5 days x 4 weeks = **400 builds/month**
- 15-minute average = 400 x 0.25 h = **100 compute hours/month** exactly
- Retries, parallel UI test shards or long archive steps push you over 100 hours and into the 250-hour tier.

| Metric | Xcode Cloud 250-hour tier | Figment Apple Silicon Mac VM | Figment Dedicated M4 Pro 48 GB |
|---|---|---|---|
| Monthly cost | $99.99 ([Apple](https://developer.apple.com/xcode-cloud/)) | $39 | $349 |
| Billing model | Metered compute hours, unused hours expire | Flat monthly fee, not metered | Flat monthly fee, not metered |
| Per-build cost at 400 builds | $0.25 ($99.99 ÷ 400) | $0.10 ($39 ÷ 400) | $0.87 ($349 ÷ 400) |
| Hardware | Apple's managed infrastructure | 4 shared vCPUs, 4GB RAM, 65GB SSD | Whole Mac: M4 Pro, 48GB RAM, 512GB SSD |

The per-build numbers do not describe equivalent hardware, and a single Mac runs builds one after another unless your CI runs jobs in parallel on it. A month has about 720 hours (30 x 24), so one Mac cannot match the 1,000-hour tier ($399.99) by running serially. Past that volume you need more Macs, which Figment quotes on a call. Teams that stay within the 25 included compute hours pay nothing for Xcode Cloud. Past them, the $39 Apple Silicon Mac VM costs less than the $49.99 tier. For Intel-compatible targets built with Xcode 26.0 to 26.3, the [Intel Mac VM](/mac-hosting#intel-vm) at $25/month (4GB RAM, 80GB SSD) is the cheapest Figment option. Xcode Cloud stays simpler if you want zero runner upkeep, because you manage your own CI, Xcode versions and secrets on a rented Mac.

## Which Figment Mac plan fits this migration?

Most teams start on the [Apple Silicon Mac VM](/mac-hosting#apple-silicon-vm) ($39/month, less than daily rentals for the one or two parallel-run weeks). It runs recent Xcode versions and arm64-only builds, while Xcode 27, visionOS simulators and arm64-only execution need Apple silicon. Use the [Dedicated M4 Pro 48 GB](/mac-hosting#dedicated-m4-pro) ($349/month) if you want a whole Mac for heavier test suites or consistent timings. Use the Intel Mac VM only if you build Intel-compatible targets with Xcode 26.0 to 26.3. Check the macOS version shown before purchase against Apple's Xcode table and see Apple's [porting guide](https://developer.apple.com/documentation/apple-silicon/porting-your-macos-apps-to-apple-silicon) for the exact Intel boundary.

## How do I disable the Xcode Cloud workflow after sign-off?

Once a self-hosted release has shipped cleanly, open App Store Connect → Xcode Cloud → Workflows, select the workflow and disable or delete it. The same workflow is also reachable from Xcode's Report navigator. UI labels shift between Xcode point releases, so follow Apple's current [Xcode Cloud documentation](https://developer.apple.com/documentation/xcode/xcode-cloud) rather than screenshots. After one or two billing cycles with no Xcode Cloud usage, lower or cancel the subscription tier.

## What is the migration checklist?

- [ ] `.xctestplan` files committed to source control
- [ ] `exportOptionsPlist` or `gym export_method` set for app-store export
- [ ] App Store Connect API key stored in CI secrets, not in the repo
- [ ] Encrypted signing `.p12` and `.mobileprovision` files installed on the runner
- [ ] Slack webhook URL stored in CI secrets
- [ ] Simulator destinations verified with `xcrun simctl list devices available`
- [ ] Self-hosted and Xcode Cloud pipelines run in parallel on at least 3 builds
- [ ] IPA size, build number and test pass/fail counts match between pipelines
- [ ] Xcode Cloud workflow disabled after the first clean self-hosted release
- [ ] Xcode Cloud tier reduced or cancelled after one idle billing cycle

**Related guides:**
- [Profile and Reduce Xcode CI Build Times](/blog/mac-ci-build-time-profiling-xcode)
- [Build Signed IPAs with Fastlane Gym in CI](/blog/mac-fastlane-gym-ipa-signing-ci)
- [Set Up Remote Xcode on Windows](/blog/mac-xcode-on-windows-remote-setup)
