Try it now: paste this line into Claude Code, Codex or Cursor. It installs box, signs you in with GitHub and runs your first build:Your first sign-in adds $10 of credit, about 200 Mac minutes (once per GitHub account).
runs-on cannot express that by itself. A job whose labels match no online runner waits in the queue (up to 24 hours); GitHub does not move it to another label.
So the choice has to be made before the job starts.
Pick the runner in a small job
A job onubuntu-latest asks the API which runners are online and idle, then outputs a JSON label list. The macOS job reads it with fromJSON:
- Listing runners needs a token with the repository’s Administration: read permission. The default
GITHUB_TOKENcannot list runners, so use a fine-grained token stored as a secret. - Fork pull requests do not receive that secret, and the
SAME_REPOcheck sends them to the hosted label anyway. On a public repository this keeps code from forks off your Mac. busycan change between the check and the job start. Two pull requests may both pick your Mac; the second one then waits for the first. Addconcurrencyto the self-hosted path if you want that to be explicit.
Keep the Mac clean between jobs
A runner registered with./config.sh --ephemeral takes one job and removes itself, so a small loop (for example a launchd job) has to register it again with a fresh registration token before each job. The same loop is a good place to delete build output and old simulators: