Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 55 additions & 11 deletions docs/hosts.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,43 @@ of the runner's user, and a LaunchAgent runs only while that user is logged in:
stopped at logout. Plan for that before anything else. This is a guided procedure assembled from GitHub's,
GitLab's and Apple's documentation; it has not been run on a Mac here.

Do the admin steps (Xcode, `pmset`, the `gitlab-runner` binary) from an administrator account, and the runner
steps logged in as the runner's user at the Mac or over Screen Sharing, not over ssh: GitLab documents that
its `launchctl` calls fail from an ssh session.

Do the admin steps (the user, Xcode, `pmset`, the `gitlab-runner` binary) from an administrator account, and
the runner steps logged in as the runner's user at the Mac or over Screen Sharing, not over ssh: GitLab
documents that its `launchctl` calls fail from an ssh session. The admin steps and the first login as the
runner's user belong to the operator, at the Mac or over Screen Sharing. An agent working on the Mac without
passwordless `sudo` stops there (`sudo -n true` answers "a password is required"): it prints the commands and
waits.

0. **Can this Mac run the job?** Answer before creating users or downloading anything:
- **Xcode version.** Find the Xcode version the jobs need (the project's CI configuration or its
maintainers), then look up the macOS it requires in Apple's
[Xcode system requirements](https://developer.apple.com/xcode/system-requirements/) table. At the time
of writing: Xcode 26.0 to 26.3 need macOS Sequoia 15.6 or later, Xcode 26.4 to 26.6 need macOS Tahoe
26.2 or later, and Xcode 27 needs macOS Tahoe 26.6 or later.
- **Intel or Apple silicon** (`uname -m`: `x86_64` or `arm64`). Xcode 27 installs and runs only on Apple
silicon ([Xcode 27 release notes](https://developer.apple.com/documentation/xcode-release-notes/xcode-27-release-notes)),
and macOS Tahoe 26 is the last release for Intel Macs. An Intel Mac tops out at the Xcode 26 releases its
macOS can run, so it is a dead end as soon as a job needs a newer Xcode.
- **A patched host.** A Mac that runs a macOS release it does not officially support, through OpenCore
Legacy Patcher, adds risk on top: graphics acceleration and Wi-Fi depend on root patches, and a macOS
update that the installed patcher version does not support can leave the host without graphics, Wi-Fi
or a working boot. Do not let the host update itself; update macOS only after the patcher supports
that release.
- **Free disk.** Xcode plus one simulator runtime take roughly 15 to 25 GB, before build output and
DerivedData (step 9). `df -h /`.

If the Mac cannot run the Xcode the jobs need, stop here.
1. **A dedicated standard user.** System Settings, Users & Groups, Add User, account type **Standard** (for
example `ci-runner`). Not an administrator, and no Apple ID, ssh keys or signing certificates of yours.
From Terminal instead, as the administrator (`-password -` prompts for the password, so it stays out of
the shell history):

```sh
sudo sysadminctl -addUser ci-runner -fullName "CI Runner" -password -
```

Without `-admin` the account is Standard. Log in once as `ci-runner` at the Mac or over Screen Sharing to
finish the account setup.
2. **Logged in after a reboot.** For the runner to come back on its own, turn on "Automatically log in as"
`ci-runner` in Users & Groups, and lock the screen. Apple's trade-off: automatic login is unavailable
while FileVault is on, and an administrator should never log in automatically. The other choice is
Expand Down Expand Up @@ -84,15 +115,23 @@ its `launchctl` calls fail from an ssh session.
the user running it, at `~/Library/LaunchAgents/actions.runner.*.plist`, with logs under
`~/Library/Logs/`.
6. **GitLab.** As the administrator, install GitLab's official binary (GitLab does not maintain the
Homebrew formula); use `gitlab-runner-darwin-amd64` on an Intel Mac. The checksums are in `release.sha256`
in the same `latest/` folder.
Homebrew formula). Pick the binary for the Mac's architecture (`uname -m`): `gitlab-runner-darwin-arm64`
on Apple silicon (`arm64`), `gitlab-runner-darwin-amd64` on an Intel Mac (`x86_64`). The checksums are in
`release.sha256` in the same `latest/` folder.

```sh
# Apple silicon (uname -m prints arm64)
sudo curl --output /usr/local/bin/gitlab-runner \
"https://s3.dualstack.us-east-1.amazonaws.com/gitlab-runner-downloads/latest/binaries/gitlab-runner-darwin-arm64"
# Intel (uname -m prints x86_64)
sudo curl --output /usr/local/bin/gitlab-runner \
"https://s3.dualstack.us-east-1.amazonaws.com/gitlab-runner-downloads/latest/binaries/gitlab-runner-darwin-amd64"

sudo chmod +x /usr/local/bin/gitlab-runner
```

Run only the `curl` line for your architecture.

Then as `ci-runner`, in a Terminal on the Mac:

```sh
Expand All @@ -106,16 +145,19 @@ its `launchctl` calls fail from an ssh session.
`concurrent = 1` in `config.toml` (it caps every runner in that file), and keep one GitHub runner
registration per Mac. One runner directory per repository, or both forges on the same Mac, means jobs
can run at the same time.
8. **Keep it awake.** As the administrator:
8. **Keep it awake.** As the administrator, first list what this Mac supports, then set only settings that
appear in that list:

```sh
pmset -g cap # capabilities of this Mac; not every Mac lists autorestart
sudo pmset -c sleep 0 # never sleep while on the charger
sudo pmset -a autorestart 1 # restart after a power loss
pmset -g # settings in use; pmset -g cap lists what this Mac supports
sudo pmset -a autorestart 1 # restart after a power loss; only if pmset -g cap lists autorestart
pmset -g # settings in use
```

`-c` is the charger (wall power) only, so a laptop on battery still sleeps on its battery settings: keep
it plugged in. Display sleep can stay on.
Where `pmset -g cap` does not list `autorestart`, skip that line. `-c` is the charger (wall power) only,
so a laptop on battery still sleeps on its battery settings: keep it plugged in. Display sleep can stay
on.
9. **Disk.** Xcode keeps derived data in `~/Library/Developer/Xcode/DerivedData` of the user that builds,
simulator runtimes are large, and the runners' work directories grow (`_work` in the GitHub runner's
directory, `builds` under the gitlab-runner working directory). Clear DerivedData as `ci-runner` when no
Expand All @@ -135,6 +177,8 @@ Sources: [GitHub, runner as a service](https://docs.github.com/en/actions/how-to
(macOS tab), [GitHub, Apple certificate](https://docs.github.com/en/actions/how-tos/deploy/deploy-to-third-party-platforms/sign-xcode-applications),
[GitLab Runner on macOS](https://docs.gitlab.com/runner/install/osx/),
[GitLab `concurrent`](https://docs.gitlab.com/runner/configuration/advanced-configuration/),
[Apple, Xcode system requirements](https://developer.apple.com/xcode/system-requirements/),
[Apple, Xcode 27 release notes](https://developer.apple.com/documentation/xcode-release-notes/xcode-27-release-notes),
[Apple, command line tools](https://developer.apple.com/documentation/xcode/installing-the-command-line-tools),
[Apple, launchd agents](https://developer.apple.com/library/archive/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html),
[Apple, automatic login](https://support.apple.com/guide/mac-help/mchlp1158/mac) and `man pmset`.
Expand Down