Skip to content

How to add a Mac runner

This turns an Apple-silicon Mac into a runner in your hoard. It runs as you: no sudo, and no root process anywhere. You need a set-up laptop; if this Mac is the laptop, it already is. Mac runner lists everything the install puts in place.

Before you start

  • Lima 2.3 or later: brew install lima.
  • git 2.40 or later at /usr/bin/git. If /usr/bin/git --version is older, point it at Xcode's: sudo xcode-select -s /Applications/Xcode.app/Contents/Developer.
  • A logged-in graphical session on the Mac. The runner is a LaunchAgent, which can't be started over plain ssh.
  • The darwin/arm64 allmyram binary. From a checkout, just build-darwin builds it into dist/darwin-arm64/allmyram, with the VM's Linux binaries inside it.
  • The VM image in the runner's cache, until the image is published as a release asset. From a checkout on the Mac:

    just vm-image
    mkdir -m 700 -p ~/Library/Application\ Support/allmyram
    just vm-image-cache
    

    Once the image is published, the runner downloads it on its first start instead. Until then, a runner without it in its cache says the download got the forge's sign-in page.

Steps

  1. On the laptop, start the invite:

    allmyram invite
    

    It prints an invite, good for 15 minutes and one connection, and waits.

  2. On the Mac, run the install with --join, giving limactl's absolute path, and paste the invite when it asks:

    ./allmyram install --limactl /opt/homebrew/bin/limactl --name macbook --join
    

    It reads the invite from the terminal, never from an argument, so ps and shell history never hold it. It checks the invite's form and every other input before it changes anything.

  3. The Mac prints a fingerprint. If the laptop shows the same fingerprint and the right name, approve on the laptop. The laptop signs the runner's host certificate and records the runner in client.json.

  4. Wait for the install to finish. The runner creates and starts its VM and checks its egress; the install prints the check lines and either egress self-check passed=true or start-up egress self-check failed. It exits 0 only when the check passed. A first passed=false isn't final: the runner recreates the VM and checks again.

Options

  • If you want the egress self-check to prove jobs can't reach a different tailnet machine, add --tailnet-peer ADDR; pick one that is up. On a runner that has already joined it works without --join.
  • If you want to limit which registries jobs pull from, add --registries FILE, one host[:port] per line (# comments allowed). To return to the defaults, delete registries from the state directory and rerun.
  • If you want to use a host key you made, add --host-key FILE, with FILE.pub beside it. A different key needs a new join.

Upgrade a Mac runner

Run the new binary's ./allmyram install with no flags; the ones you gave before are kept. It stops the agent, which stops the VM, copies the new binary into place and starts the agent again. The runner then recreates the VM from the cached image, which downloads nothing. The job data disk is kept.

The host certificate renews itself as on Linux; after a long absence, run allmyram renew macbook on the laptop.

Rejoin a Mac runner

Pass --join again, with a fresh allmyram invite. --join is never remembered. A failed rejoin that changed nothing starts the runner again with its previous trust.

A Mac installed before joins existed keeps its old runner.json, which the runner refuses, and no agent, until it joins. The join removes the old ca.pub, runner-host-key-cert.pub, allowed-clients and tailnet-peer. install no longer takes --ca-pub, --host-cert or --allowed.

Remove a Mac runner

  1. On the laptop: allmyram remove macbook.
  2. On the Mac, stop the agent:

    launchctl bootout gui/$(id -u)/name.allmyram.runner
    
  3. Wait until the runner has stopped its VM, which can take 2 minutes after bootout returns. Both must hold: the first command fails, and the second prints nothing.

    launchctl print gui/$(id -u)/name.allmyram.runner
    pgrep -f "Application Support/allmyram/lima"
    
  4. Remove the files:

    rm ~/Library/LaunchAgents/name.allmyram.runner.plist
    rm -r ~/Library/Logs/allmyram ~/Library/Application\ Support/allmyram
    

Removing the state directory while the VM still runs leaves a VM process with nothing to stop it. Nothing else on the Mac was changed.

The job data disk won't mount

Every VM start fails its service check, and runner.log says the VM's allmyram services are not active. The data disk outlives every recreate of the VM, so a damaged filesystem on it stays damaged. It holds only running workspaces and caches, so delete it and let the runner make a blank one.

  1. Stop the runner and wait until it has stopped the VM, as in Remove a Mac runner: launchctl print fails and pgrep prints nothing.

    launchctl bootout gui/$(id -u)/name.allmyram.runner
    launchctl print gui/$(id -u)/name.allmyram.runner
    pgrep -f "Application Support/allmyram/lima"
    
  2. Delete the VM and the disk. The VM's config names the disk, so both go. Use the limactl you gave --limactl.

    export LIMA_HOME=~/Library/Application\ Support/allmyram/lima
    limactl delete --force allmyram
    limactl disk delete allmyram-data
    unset LIMA_HOME
    
  3. Start the runner again. It creates the VM and a blank disk, which the VM formats at its first boot.

    launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/name.allmyram.runner.plist