Skip to content

Guide

Xcode CI on a dedicated Mac Studio.

Long iOS and macOS builds are where shared CI runners get slow and expensive. A dedicated Mac Studio in the EU gives you one warm machine that only your jobs use. This guide covers installing a self-hosted runner, code signing on a headless Mac, simulators, caching and how to size the machine.

Updated

Why a dedicated Mac beats shared macOS runners for long builds

Hosted macOS runners are convenient, but every job starts on a fresh virtual machine. That means a cold DerivedData folder, a cold Swift Package Manager cache, simulators that have to boot from nothing, and a build that competes with other tenants for the same host.

On a dedicated Mac mini or Mac Studio nothing is reset between jobs unless you decide it should be. Incremental builds stay incremental, packages are already resolved, and the simulator you booted an hour ago is still there. The CPU, GPU, memory and SSD belong to your pipeline alone, so build times are repeatable instead of varying with the neighbours.

You also pick the Xcode versions. Install several side by side, select one per job with DEVELOPER_DIR, and upgrade on your schedule rather than when a hosted image changes. And because the machine sits in Prague, Czech Republic, source code and signing material stay with an EU operator, which helps when a client asks where builds run.

Install a self-hosted runner as a launchd service

All three major systems work the same way: a small agent on the Mac polls your CI server, runs jobs and reports back. Nothing needs to be opened inbound on the fixed public IP, because the connection is outbound. SSH and Screen Sharing still use the ports we forward on that address.

  • GitHub Actions: add a macOS ARM64 runner under your repository or organisation settings, run config.sh with the token it shows, then use ./svc.sh install and ./svc.sh start so it launches at login and restarts after a reboot. Target it with runs-on: [self-hosted, macOS, ARM64].
  • GitLab: install gitlab-runner with the shell executor, register it against your instance with a tag such as macos, and run gitlab-runner install and start. The shell executor uses the real Xcode toolchain, which is what you want here.
  • Buildkite: install the buildkite-agent, set its token and queue in buildkite-agent.cfg, and let the launchd service keep it running.
Mac configurations for CI and Xcode builds
ConfigurationMemoryInternal SSDSuited toPrice per month
Mac mini M624 GB512 GBOne small app, unit tests, a single simulator129 EUR
Mac mini M5 Pro64 GB1 TBA couple of apps, moderate parallel jobs219 EUR
M5 Max36 GB512 GBOne or two apps, unit tests, a few simulators349 EUR
M5 Max128 GB2 TBSeveral apps, parallel jobs, many Xcode versions649 EUR
M5 Ultra256 GB4 TBLarge monorepos, heavy parallel UI test suites1,149 EUR
Suitability is a planning guide, not a benchmark. Weekly rates are 49, 89, 139, 239 and 429 EUR, and 24-hour rates are 10, 19, 29, 49 and 89 EUR, in the order of the rows. Prices exclude VAT.

Code signing and the keychain on a headless Mac

Signing is the step that most often breaks on a machine nobody sits at. Do not use the login keychain. Create a dedicated one for CI so you control when it is unlocked and what can use it.

The usual sequence: create it with security create-keychain, add it to the search list, import your distribution certificate and private key as a .p12, then run security set-key-partition-list with the apple-tool: and apple: partitions so codesign can use the key without a prompt. Unlock the keychain at the start of each job and set a long timeout.

Prefer fastlane match or a secrets store for the certificates and provisioning profiles, so the Mac holds nothing that cannot be rebuilt. Keep the App Store Connect API key in your CI secret store and pass it to fastlane at run time rather than leaving it on disk. Since you have full admin access, you can script all of this with a one-time bootstrap shell script and keep it in your repository.

Simulators, UI tests and caching DerivedData

Unit tests and xcodebuild builds run fine over SSH. Simulator-based UI tests are more demanding because they want a logged-in graphical session. Connect once with Screen Sharing, sign in with the build user, and run the runner as that user's launchd agent so jobs inherit the session. Pre-create the simulators you need with xcrun simctl and keep them, since a booted, warmed simulator saves real time on every run.

Point DerivedData and your package caches at fast local storage. The internal SSD is enough for one or two projects. If you build many apps, archive often or keep several Xcode versions, add a Thunderbolt 5 SSD of 2, 4 or 8 TB for 39, 69 or 129 EUR per month. In stock, connected within 60 minutes. Use the -derivedDataPath flag to keep each project in its own folder, and prune old ones with a nightly job.

Cache invalidation is still your job. When a build behaves strangely after a toolchain upgrade, delete that project's DerivedData folder and rebuild. Because the disk is yours, that is a single command rather than a support ticket.

The 24-hour minimum is not a problem for CI

Apple's macOS licence allows a Mac to be leased only for periods of at least 24 hours, which is why the minimum rental is 24 hours. For a CI runner that is rarely a constraint, because a build machine is useful precisely when it stays around: caches, simulators and signing set-up all pay off over days, not minutes.

Rent the Mac mini M6 for 24 hours at 10 EUR to prove the pipeline, move to a weekly plan for a release crunch, and switch to a monthly plan at 129 EUR once the runner is part of your daily workflow. Monthly plans can be cancelled at any time, and all prices exclude VAT. Businesses in other EU countries with a valid VAT ID are invoiced with reverse charge. Czech businesses and EU consumers pay 21% Czech VAT.

The setup target is 3 hours from payment. Three hours is a target, not a guaranteed time. If we cannot deliver the machine or storage you ordered, we cancel the order and refund the full amount. Between customers the disk is erased and macOS is reinstalled, so you start from a clean system.

Frequently asked questions

Can I use this as a GitHub Actions self-hosted runner?

Yes. You have full admin access over SSH and Screen Sharing, so you can install the runner, run it as a launchd service and target it with the self-hosted, macOS and ARM64 labels. GitLab Runner and the Buildkite agent install the same way.

Is it safe to run pull requests from forks on a self-hosted runner?

Not by default. Jobs run code on your machine with access to anything stored there. Limit the runner to private repositories or trusted contributors, keep secrets out of fork workflows, and store signing material in a dedicated keychain.

Can I run several jobs in parallel?

Yes, by registering more than one runner instance or raising concurrency. Each Xcode build is memory and I/O heavy, so size the machine for the number of simultaneous builds. The 128 GB configuration is the usual choice for parallel jobs.

Which Xcode versions can I install?

Any version that runs on the macOS release installed on the machine. Download the versions you need from Apple, keep them in separate folders and select one per job with DEVELOPER_DIR or xcode-select.

Why is there a 24-hour minimum?

Apple's macOS licence only permits leasing a Mac for 24 hours or longer. For a CI runner this has little effect, because the value comes from warm caches and a stable set-up that last for days.

What happens to my code and certificates when I cancel?

The disk is erased and macOS is reinstalled between customers. Before cancelling, revoke or rotate anything you installed, such as certificates, runner tokens and SSH keys, and remove the runner from your CI settings.

Recommended for this guide

Mac Studio, M5 Max

36 GB unified memory

For large Xcode builds, renders and local models up to about 30B.

€349/moor €29 per 24 hours, excl. VAT€422.29 incl. VAT per month, €35.09 incl. VAT for 24 hours