How to Set Up a Mac Mini as a Self-Hosted GitHub Runner
Step-by-step 2026 guide: register a hosted M4 Mac mini as a self-hosted GitHub Actions runner, handle code signing, ship to TestFlight, and survive reboots.

Every iOS team eventually hits the ceiling of shared macOS build machines: jobs queue behind other people's work, caches vanish between runs, and the Xcode version you need is never quite there. A self-hosted GitHub Actions runner on a Mac mini M4 solves all three problems at once — you get a persistent, always-warm build machine that you fully control. Here is the complete 2026 walkthrough, from registration to TestFlight delivery, on a hosted mini.
Prerequisites: Repo Access and a Hosted M4 Mac Mini
Before touching a terminal, you need four things:
- Admin rights on the GitHub repository or organization where the runner will live.
- A Mac mini M4 with macOS and SSH access. You can rack one yourself, but a hosted machine saves you the hardware, connectivity, and remote-hands headaches. Sayob's Apple Silicon hosting offers hosted Mac mini M4 plans from EUR 119 to EUR 399 per month, running in the Equinix FR5 data center in Frankfurt under German and EU (GDPR) jurisdiction.
- An Apple Developer Program membership, plus an App Store Connect API key (Issuer ID, Key ID, and the
.p8file) for uploads. - Xcode installed on the mini — the full app, then
sudo xcodebuild -license acceptandxcodebuild -runFirstLaunchover SSH.
Why self-host at all? A quick side-by-side:
| GitHub-hosted macOS runner | Self-hosted on a Mac mini M4 | |
|---|---|---|
| Billing | Per minute, with a macOS multiplier | Flat monthly rate, unlimited minutes |
| Caches and DerivedData | Reset on every job | Persist between runs |
| Xcode versions | Whatever the image ships with | Any version you install, betas included |
| Simulators and toolchain | Fixed image | Fully under your control |
| Availability | GitHub-managed | Yours to keep alive (covered below) |
Registering the Self-Hosted Runner with GitHub
In your repository, open Settings → Actions → Runners → New self-hosted runner and pick macOS / ARM64. Then SSH into the mini and run the commands GitHub displays:
mkdir actions-runner && cd actions-runner
curl -o actions-runner-osx-arm64.tar.gz -L <download URL from GitHub>
tar xzf actions-runner-osx-arm64.tar.gz
./config.sh --url https://github.com/YOUR-ORG/YOUR-REPO --token <registration token>
./run.sh
config.sh asks for a runner name and labels — keep the defaults (self-hosted, macOS, ARM64) and add something like ios-build. Once run.sh reports "Listening for Jobs", point a workflow at it:
jobs:
build:
runs-on: [self-hosted, macOS, ARM64, ios-build]
Push a trivial workflow and confirm the job actually lands on the mini before going further. If several repositories should share the machine, register the runner at the organization level instead and assign it through runner groups.
Code Signing and Keychain Setup Without a GUI Session
CI code signing fails in confusing ways when certificates sit in the login keychain of a user who is not logged in. The reliable pattern is a dedicated keychain, created inside the job or once per machine:
security create-keychain -p "$KEYCHAIN_PW" ci.keychain
security set-keychain-settings -lut 21600 ci.keychain
security unlock-keychain -p "$KEYCHAIN_PW" ci.keychain
security import cert.p12 -k ci.keychain -P "$P12_PW" -T /usr/bin/codesign
security set-key-partition-list -S apple-tool:,apple: -s -k "$KEYCHAIN_PW" ci.keychain
security list-keychains -d user -s ci.keychain login.keychain
Store the .p12 certificate and the App Store Connect .p8 key as base64-encoded GitHub Actions secrets and decode them at the start of the job. The set-key-partition-list line is the one everyone forgets — without it, codesign hangs forever waiting for a permission dialog that nobody can click. Teams already using fastlane can let match manage certificates instead; the keychain mechanics stay the same underneath.
Shipping a Build to TestFlight End to End
With signing solved, the pipeline is three steps: archive, export, upload.
- Archive:
xcodebuild -scheme YourApp -destination 'generic/platform=iOS' -archivePath build/YourApp.xcarchive archive - Export:
xcodebuild -exportArchive -archivePath build/YourApp.xcarchive -exportOptionsPlist ExportOptions.plist -exportPath build/ipa, withmethodset toapp-store-connectin the plist. - Upload: either set
destination: uploadin the same plist so the export step pushes straight to App Store Connect, or run fastlane'supload_to_testflightwith your API key. Avoidaltool; it has been retired.
Because the runner persists, ~/Library/Developer/Xcode/DerivedData and your SwiftPM or CocoaPods caches survive between runs, so later builds reuse earlier work instead of starting cold. Once the upload succeeds, App Store Connect processes the build and notifies your testers — your workflow can end at a green upload step.
Keeping the Runner Alive: Launch Agents and Reboots
run.sh in a terminal dies with your SSH session. Install the runner as a service instead:
./svc.sh install
./svc.sh start
On macOS this creates a LaunchAgent (~/Library/LaunchAgents/actions.runner.*.plist), which only starts when its user logs in. Two settings make the runner survive reboots unattended:
- Enable automatic login for the CI user (System Settings → Users & Groups). This gives the runner a real GUI session, which the iOS simulator and some signing operations quietly require anyway.
- Run
sudo pmset autorestart 1so the mini powers back on after any power interruption.
Also disable automatic macOS updates and schedule them as deliberate maintenance windows — an unplanned major upgrade can break Xcode in the middle of a release week. On a hosted mini in a professional data center with redundant power and network, reboots become rare events, but they should still be boring when they happen.
Security Notes for Runners on Public Repos
GitHub's own guidance is blunt: do not attach self-hosted runners to public repositories unless you have contained the blast radius. Anyone can fork a public repo and open a pull request that executes arbitrary code on your machine. If your repository is public:
- Require approval for workflow runs from outside contributors (Settings → Actions).
- Run the runner with the
--ephemeralflag so each job gets a freshly registered runner and no state leaks between jobs. - Never expose signing certificates or API keys to workflows triggered by fork pull requests; gate TestFlight uploads behind protected branches or environments with required reviewers.
- Keep the runner in its own macOS user account without admin rights, and keep the OS patched.
For private repositories the risk drops sharply, but ephemeral runners and least-privilege accounts remain good hygiene.
FAQ
Can one Mac mini serve several apps or teams? Yes. Register the runner at the organization level and share it through runner groups. When a single machine stops being enough, Sayob's Thunderbolt 5 cluster configurations let you operate multiple hosted minis as a pool of runners.
Do I need to keep an SSH session open? No. Once the LaunchAgent is installed and automatic login is enabled, the runner reconnects to GitHub on its own after every reboot.
What about the Linux jobs in the same pipeline? Keep macOS jobs on the mini and send Linux jobs to a VPS or a dedicated machine; a matrix workflow can target both with different runs-on labels.
Questions about sizing a runner fleet or a cluster setup? Get in touch and our team will help you plan it.
Related articles

Как выбрать сервер AMD EPYC: Максимальная производительность по лучшей цене
Узнайте, как выбрать сервер AMD EPYC для ваших нужд. Доступные цены и профессиональные советы ждут вас!

Как выбрать dedicated server: Лучший выбор для ваших нужд
Узнайте, как выбрать идеальный dedicated server с AMD EPYC. Улучшите производительность и безопасность вашего бизнеса!

Настройте AMD EPYC сервер и улучшите производительность
Узнайте, как настроить AMD EPYC сервер для максимальной производительности. Реализуйте лучшие практики и воспользуйтесь нашим сервисом!
Want help planning your hosting setup?
Talk to our team about configurations, locations and the right infrastructure for your workload.