iOS CI on a remote Mac: self-hosted GitHub Actions + fastlane

Sooner or later every iOS project wants “push a commit, get a TestFlight build”. Hosted CI can do it with macOS machines, but there are two familiar pain points:

If you have a Mac that’s on 24/7 — your own or a rented one — you can register it as a self-hosted GitHub Actions runner. Dependencies and caches stay on the machine, so every build after the first is much faster, and the cost is fixed.

Prepare the Mac

brew install fastlane
brew install cocoapods   # only if your project uses CocoaPods

Step 1: Register the runner

  1. In your GitHub repository go to Settings → Actions → Runners → New self-hosted runner.
  2. Choose macOS and ARM64 (Apple silicon).
  3. GitHub shows a set of commands (download, extract, ./config.sh --url ... --token ...). Run them exactly as shown in Terminal on the Mac. The token expires — if it does, reopen the page for a new one.
  4. Add a label such as ios during setup so workflows can target this runner.

Run ./run.sh in the foreground first. When GitHub shows the runner as Idle, it’s connected.

Step 2: Keep it running

A foreground runner stops when you close Terminal. Install it as a service from the runner directory:

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

This installs a LaunchAgent for the current user, which starts when that user logs in. So the Mac should log in to this user automatically at startup and never sleep — otherwise the runner goes offline after a restart or a nap.

Step 3: Write the workflow

Create .github/workflows/ios.yml:

name: iOS build
on:
  push:
    branches: [main]
jobs:
  build:
    runs-on: [self-hosted, macOS, ARM64]
    steps:
      - uses: actions/checkout@v4
      - name: Build & upload to TestFlight
        run: fastlane beta
        env:
          APP_STORE_CONNECT_API_KEY_JSON: ${{ secrets.ASC_KEY_JSON }}

fastlane beta is a lane you define in fastlane/Fastfile — typically: fetch certificates → build_app → upload_to_testflight.

Code signing: where most setups get stuck

Security: private repositories only

GitHub’s own advice: don’t use self-hosted runners with public repositories. Anyone can open a pull request on a public repo, and the workflow would run their code on your machine.

Also:

With Tokyo Mac

A Tokyo Mac machine is a dedicated Mac mini (current configurations are listed in the store) in Tokyo, with sleep and screen lock turned off and automatic login to your account — exactly what an always-on runner needs. Tick Homebrew when you set up your account, then follow the steps above to install Xcode and register the runner.

Want to check build speed and the network first? Start with a 24-hour trial.

Related: How to build and publish an iOS app without owning a Mac · How to connect to a remote Mac

More guides