Skip to main content
A phone has to be plugged into the Mac that tests it, so testing on an iPhone in CI takes a Mac of yours. A Mac mini on a shelf is the usual choice, and any Apple silicon Mac works. Your code, builds, screenshots and videos stay on it and in your CI host’s artifacts.

What you need

With Mobster for Mac, sign the runner in to your account, as you do your own Mac (Your Macs).

1. The Mac

Make a standard user for the runner, such as ci, and sign in as that user for the rest of this page. Then:
  1. Turn on automatic login for it in System Settings › Users & Groups. After a restart, the runner and the simulators start again without anyone at the Mac.
  2. Keep the Mac awake and have it restart after a power cut:
    The display may sleep. Simulators don’t need it.
  3. Turn on Screen Sharing or Remote Login in System Settings › General › Sharing, to reach a Mac with no screen.

2. Xcode and a simulator

Install Xcode from the App Store, open it once, then:

3. Mobster

Install Mobster, then prepare a simulator, so the first job doesn’t wait for one:
The first time builds WebDriverAgent, which takes several minutes. Later jobs reuse it.

4. The runner

In your repository (or organization), open Settings › Actions › Runners › New self-hosted runner, and pick macOS and ARM64. Run the commands GitHub shows in ~/actions-runner, and add the mobster label when config.sh asks for labels:
svc.sh install runs the runner as a LaunchAgent of the ci user. Keep it that way: a runner started as a system daemon can’t reach the user’s simulators, Keychain or iPhone.

5. The iPhone

Skip this for simulators only.
  1. Plug the phone into the Mac with a cable, and set it up with mobster setup or in Mobster for Mac, signed in as the runner’s user (Device setup). Developer Mode stays on.
  2. On the phone, set Settings › Display & Brightness › Auto-Lock to Never, and keep it on its cable so it charges.
  3. Name it in the runner’s own environment, so a pull request can’t reach a phone the runner’s owner didn’t list:
~/actions-runner/.env
Then ./svc.sh stop && ./svc.sh start.
MOBSTER_RUNNER_TESTFLIGHT lists the bundle IDs of TestFlight builds the jobs may test on the phone, the same way.

6. Check it

A row marked ✗ fails the check and says the fix. A row marked ! works, and is worth fixing. Then run mobster ci init --self-hosted (next release) in your project (CI, GitLab CI).

Keeping it running

  • When you update Xcode or Mobster on your own Mac, update the runner too: Xcode, and Mobster for Mac or the mobster-cli version your workflow pins. CI then builds what you build.
  • Delete simulators of runtimes you removed: xcrun simctl delete unavailable.
  • Xcode’s DerivedData and old simulator runtimes fill the disk. mobster ci doctor warns under 30 GB free and fails under 10 GB.
  • One runner runs one job at a time. For more jobs at once, add a second Mac, and split the checks with --shard (CI).
A self-hosted runner runs the code of every pull request it picks up, as the runner’s user, on the Mac the phone is plugged into. Don’t connect one to a public repository that takes pull requests from forks.