Blog· What you can do with your Mac mini·

Self-hosted GitHub Actions runner on a Mac mini: set it up step by step

Turn a rented Mac mini M6 into a self-hosted macOS runner for GitHub Actions or GitLab in about twenty minutes: Xcode, registration, a launchd service, a first iOS workflow and the upkeep.

A Mac mini on a glowing conveyor belt with white cubes passing through it, like a build pipeline

Every iOS or macOS project that uses continuous integration needs a Mac somewhere in the pipeline. GitHub offers hosted macOS machines by the minute, but many teams prefer a Mac of their own that picks up jobs from their repositories: the caches stay warm between builds, the Xcode version is the one they chose, and the bill does not grow with every push.

Some cloud providers sell a Mac with a runner already installed. You do not need that: the runner is a small program you register yourself, and on a dedicated Mac mini it takes about twenty minutes. This guide walks through the whole setup on a SoloRack Mac mini M6, from the first SSH login to a green workflow, then covers GitLab and the habits that keep a build Mac fast.

What you need before you start

  • A Mac you can reach over SSH. On a SoloRack Mac, open My account, add your public SSH key, and copy the command shown there. It looks like ssh -p <port> <user>@connect.solorack.com. Your account on the Mac is an administrator account, so everything below works without asking anyone.
  • A GitHub repository where you are an admin, or an organisation where you are an owner. Use a private repository: GitHub itself warns that on a public one, anyone who opens a pull request from a fork could run code on your runner.
  • Xcode, if you build Apple apps. You install it yourself, from the App Store, signed in with your own Apple Account. Open the Mac by remote desktop for this step, since the App Store needs the desktop.

Node.js and Python are already installed on every SoloRack Mac. Homebrew and Git are not: install them if your pipeline needs them.

Step 1: get Xcode ready for unattended builds

A runner has nobody at the keyboard, so every first-launch prompt has to be answered in advance. After Xcode finishes installing, connect over SSH and run:

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
sudo xcodebuild -license accept
xcodebuild -runFirstLaunch
xcodebuild -downloadPlatform iOS

The first line points the command-line tools at the full Xcode, the second accepts the licence, the third installs the extra components Xcode wants on first launch, and the last one downloads the iOS Simulator runtime your tests will use. Check the result with xcodebuild -version and xcrun simctl list devices available: write down one iPhone name from that list for later.

Step 2: ask GitHub for a registration token

In your repository, open Settings, then Actions, then Runners, and click New self-hosted runner. Choose macOS and the ARM64 architecture, because the Mac mini M6 runs on Apple silicon.

GitHub now shows a short block of commands under Download and Configure. Keep that page open. The commands contain the exact download link for the current runner version and a registration token. The token works once and expires after one hour, so do the next step straight away, and never paste the token in a chat or a ticket.

For an organisation, the same page is under the organisation’s Settings > Actions > Runners, and the runner can then serve several repositories.

Step 3: download and register the runner

In your SSH session, create a folder in your home directory and run the download lines exactly as GitHub shows them. They follow this pattern:

mkdir ~/actions-runner && cd ~/actions-runner
curl -o actions-runner-osx-arm64-<version>.tar.gz -L <link shown by GitHub>
tar xzf ./actions-runner-osx-arm64-<version>.tar.gz

Then register it. Start from the ./config.sh line on the GitHub page and add a name and a label of your own:

./config.sh --url https://github.com/<owner>/<repo> --token <token> \
  --name m6-build --labels ios-build --unattended

--unattended accepts the defaults instead of asking questions. The runner always gets the labels self-hosted, macOS and ARM64. Your own label, here ios-build, lets a workflow ask for this exact Mac. When the command finishes, the runner appears in the Runners list on GitHub, still offline until you start it.

Step 4: keep it running as a service

You could start the runner with ./run.sh, but it would stop when you close SSH. Install it as a service instead:

./svc.sh install
./svc.sh start
./svc.sh status

On macOS the service is a launchd agent that runs inside your user session, so jobs have your PATH, your Homebrew tools and your keychain. On a SoloRack Mac this fits well: after a restart, including one you start from My account, the Mac signs back in to your session by itself, and the runner starts again with it. If you ever change your macOS password, set automatic login again with the new one, as the access email explains, so the session and the runner come back after the next restart.

Back on GitHub, the runner is now Idle, waiting for jobs.

Step 5: your first workflow on the Mac

Create .github/workflows/ios.yml in the repository:

name: iOS tests
on: [push, pull_request]

jobs:
  test:
    runs-on: [self-hosted, macOS, ARM64, ios-build]
    steps:
      - uses: actions/checkout@v4
      - name: Run the tests
        run: |
          xcodebuild test \
            -scheme MyApp \
            -destination 'platform=iOS Simulator,name=<iPhone from step 1>'

Replace MyApp with your scheme and the iPhone with a name from the list in step 1. Push, open the Actions tab, and watch the job run on your Mac. The first run fetches packages and builds everything. The second one starts from the DerivedData and Swift Package Manager caches already on the SSD, and that warm start is the main reason teams keep a Mac of their own.

Steps run directly on macOS, so xcodebuild, xcrun, fastlane and anything you installed with Homebrew work without setup actions. If you keep two Xcode versions, choose one per job by setting DEVELOPER_DIR in the job’s env.

For release builds, code signing and TestFlight uploads, our macOS runner page explains the keychain and App Store Connect API key setup.

Using GitLab instead

The same Mac works as a GitLab runner. Install Homebrew first, then:

brew install gitlab-runner

In GitLab, open your project’s Settings > CI/CD > Runners, create a new project runner, give it a tag such as macos, and copy the token GitLab shows. Back on the Mac:

gitlab-runner register --url https://gitlab.com --token <token>
brew services start gitlab-runner

When register asks for an executor, choose shell, so jobs run straight on macOS with your tools. In .gitlab-ci.yml, add tags: [macos] to the jobs that need the Mac. brew services keeps the runner going after restarts, the same way the GitHub service does.

Keeping the runner healthy

A build Mac stays fast with a few habits:

  • One heavy job at a time. A registered runner takes one job at a time. You can register a second runner in another folder for light jobs, such as linting, but two Xcode builds side by side mostly slow each other down.
  • Watch the disk. The Mac has 256 GB, and Xcode, simulator runtimes and archives add up. Now and then, run rm -rf ~/Library/Developer/Xcode/DerivedData/* and xcrun simctl delete unavailable, and remove simulator runtimes you no longer test on.
  • Update Xcode when you decide. Install a new version next to the old one, run your pipeline against it on a branch, and switch the default with xcode-select only when it is green. The runner program updates itself, so you do not need to touch it.
  • Keep secrets in GitHub. Store certificates, passwords and API keys as repository or organisation secrets, and let the workflow write them to a temporary keychain. Nothing sensitive needs to live in the runner folder.
  • Moving the runner. A runner’s URL and name are fixed at registration. To point it at another repository, run ./svc.sh stop and ./svc.sh uninstall, then ./config.sh remove --token <token> with the removal token from the runner’s page on GitHub, and register again from step 2.

When the rental ends

When a SoloRack rental ends, your macOS account and every file on the Mac are deleted, with no copy kept anywhere. Before that day, export your signing certificates and anything else you want to keep, and remove the runner from Settings > Actions > Runners on GitHub so your workflows stop waiting for a Mac that is gone. The reminders before the end of the rental tell you the same, in time.

Run your pipelines on a dedicated Mac mini

A runner is only as good as the Mac behind it. A SoloRack Mac mini M6 is a whole physical Mac for you alone, with a 12-core CPU, 16 GB of memory and a 1 Gbit/s connection, in the datacenter closest to you among those available when you book. It stays on around the clock, keeps your caches between builds and costs the same however many minutes your jobs take: from $3.73 a day with the monthly plan, $112 a month. See the plans on our pricing page and have your runner online today.

Try SoloRack from ⁦$3.73⁩ a day

A dedicated Mac mini M6 on the monthly plan: ⁦$112⁩ a month. Prices in US dollars, VAT included where it applies.

Before you pay

The email you enter on the payment page becomes your account: you sign in to My account with that same address.

Payment is handled by Stripe through Link, its payment service: the payment page shows Link's name, and your bank statement will show LINK.COM* SOLORACK.

They show us how the site is used, including recordings of your visit; what you type stays hidden (PostHog, Google Analytics). These tools use cookies and start only if you say yes. You can change your mind at any time from the bottom of the page. If you say no to statistics, we only count your visit, without cookies. Cookie policy