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.
| Configuration | Memory | Internal SSD | Suited to | Price per month |
|---|---|---|---|---|
| Mac mini M6 | 24 GB | 512 GB | One small app, unit tests, a single simulator | 129 EUR |
| Mac mini M5 Pro | 64 GB | 1 TB | A couple of apps, moderate parallel jobs | 219 EUR |
| M5 Max | 36 GB | 512 GB | One or two apps, unit tests, a few simulators | 349 EUR |
| M5 Max | 128 GB | 2 TB | Several apps, parallel jobs, many Xcode versions | 649 EUR |
| M5 Ultra | 256 GB | 4 TB | Large monorepos, heavy parallel UI test suites | 1,149 EUR |
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.