TürkiyeVPS

macOS Runner for GitHub Actions and GitLab: Your Own CI Machine on a Rented Mac mini

Turn a rented Mac mini into a GitHub Actions or GitLab self-hosted runner for your iOS and macOS projects: setup steps, running it as a service, code signing, security and a cost comparison with per-minute macOS runners.

5 min read

Every team that builds iOS or macOS apps reaches the same question sooner or later: do we keep building by hand, or should every git push build and test automatically? Automated builds need a Mac running Xcode. This guide shows, step by step, how to turn a dedicated Mac mini that is on 24/7 into your own macOS runner for GitHub Actions and GitLab.

Quick summary: Install the runner software on the Mac over SSH, start it as a background service and write runs-on: [self-hosted, macOS] in your workflow. Build caches stay on the Mac, so jobs start fast and the cost is a fixed monthly fee. See our Mac plans in Istanbul on the Mac mini rental page.

Why your own macOS runner?

  • Fixed cost: GitHub-hosted macOS runners are billed per minute (at the time of writing about 0.06 USD per minute for the standard macOS runner; check GitHub's pricing page for the current rate). At that rate roughly 1,400 build minutes (23 hours) a month already cost as much as a whole month of Mac Starter. If you build more, your own Mac is cheaper.
  • Speed: jobs do not start on a clean machine every time; Xcode, CocoaPods / Swift Package caches and DerivedData stay on the Mac, so dependency downloads shrink.
  • Control: you install the Xcode version, simulators and tools you need, and there is no shared queue.

1. Prepare the Mac

Connect over SSH (for the first setup you may also want to look at the desktop over VNC; see Connecting to a remote Mac with VNC and SSH). Then:

xcode-select -p                 # is Xcode installed?
sudo xcodebuild -license accept
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install git fastlane cocoapods

It is safer to run the runner as a separate user, not your admin account: create a standard user called ci in System Settings → Users & Groups and install the runner as that user.

2. GitHub Actions self-hosted runner

  1. In your repository (or organization) open Settings → Actions → Runners → New self-hosted runner.
  2. Choose macOS and architecture ARM64. GitHub shows the download and config.sh commands with a one-time token.
  3. Run them on the Mac and give the runner useful labels when asked (e.g. xcode, m-series):
mkdir actions-runner && cd actions-runner
# the curl + tar commands GitHub shows you
./config.sh --url https://github.com/user/repo --token TOKEN --labels xcode
./svc.sh install
./svc.sh start

svc.sh install makes the runner a launchd service, so it comes back by itself after a reboot. In your workflow:

jobs:
  ios:
    runs-on: [self-hosted, macOS, xcode]
    steps:
      - uses: actions/checkout@v4
      - run: xcodebuild -scheme App -destination 'platform=iOS Simulator,name=iPhone 16' test

3. GitLab Runner

brew install gitlab-runner
gitlab-runner register --url https://gitlab.com --token TOKEN --executor shell
brew services start gitlab-runner

Get the token in GitLab under project → Settings → CI/CD → Runners and select this runner with tags: in .gitlab-ci.yml. With Jenkins, simply add the Mac as an SSH agent.

4. Code signing and TestFlight

  • Import your distribution certificate (.p12) into the runner user's keychain once. If the keychain is locked in SSH jobs, unlock it before building: security unlock-keychain -p "$KEYCHAIN_PASSWORD" login.keychain-db
  • Keep passwords in GitHub/GitLab secrets, never in the workflow file.
  • Fastlane match plus an App Store Connect API key and the upload_to_testflight action send every successful build to TestFlight automatically.

A step-by-step walkthrough with a sample Fastfile and both signing options: upload to TestFlight with Fastlane.

5. Security rules

  • Do not use a self-hosted runner on public repositories: a pull request from a stranger could run code on your Mac. Use it only for private repositories or trusted contributors.
  • Run the runner as the non-admin ci user; use SSH keys instead of passwords.
  • Back up your signing certificates and API keys separately; do not treat the Mac as the only copy.

6. Disk and maintenance

A build machine's disk fills up over time. Add a weekly cleanup job:

rm -rf ~/Library/Developer/Xcode/DerivedData/*
xcrun simctl delete unavailable
brew cleanup

If you need several Xcode versions, install them side by side with xcodes and pick one in the workflow with DEVELOPER_DIR.

Which Mac is enough?

For one app and a small team that runs jobs one after another, Mac Starter with 16 GB RAM is enough. If you run tests on several simulators at once, build large Swift / Unity projects or run more than one runner, the 24 GB or 32 GB plans are more comfortable. For day-to-day Xcode tips see our Remote Mac for Xcode guide.

Frequently Asked Questions

Can I run more than one runner on one Mac?

Yes, you can install several runners in different folders. But two Xcode builds at the same time share RAM and disk: one runner works best on 16 GB, two on the bigger plans.

Does the runner keep working after the Mac restarts?

Yes, if you installed it as a service with ./svc.sh install (GitHub) or brew services start gitlab-runner (GitLab); the Mac also powers back on by itself after a power cut.

Can my team share the rented Mac?

Yes. The Mac is rented only to you (your team); your team members can connect over SSH and use the same runner. A Mac is never shared with another customer.