# hivemux swarm: run Claude Code's builds on your other Macs

hivemux swarm sends the tests, builds, dev servers and Docker that Claude Code starts to your Mac with room; output, exit codes and ports come back.

Source: https://hivemux.dev/docs/extensions/swarm/

hivemux swarm runs the heavy commands Claude Code starts (tests, builds, dev servers, Docker) on whichever of your Macs has room: a spare Mac at home, an idle one at the office. You keep working on one Mac (the master). The commands go out to the others (workers) and come back as if they had run here: the same output, the same exit code, and `localhost` ports that just work. Install it with `brew install hivemux/tap/hivemux-swarm`. It works on its own as `hivemux-swarm`, and as `hivemux swarm` next to hivemux 0.1.105 or later.

[Image: hivemux-swarm status: two Macs, the Mac Studio you work on and a Mac mini worker, running three jobs, with the dev server's port 5173 opened on the master]

## When it helps

- Several Claude Code sessions each run tests and builds, and the Mac you work on slows down or its fans spin up.
- You have another Mac that sits idle most of the day.
- A build or test suite is slow, and you would rather it ran while you keep typing.

## How it works

- **A Claude Code hook** sees a Bash command such as `npm test`, `cargo build` or `npm run dev` in a project you turned on, and runs it through `hivemux-swarm run`. Claude reads the output as usual.
- **The scheduler** on the master measures every computer's cores, memory and disk every 2 seconds, keeps a history of what each job usually takes, and puts the job where it fits best. The master is a worker too, minus 2 cores and 4 GB kept for Claude and you. When every computer is busy, jobs wait in line; after 10 seconds the master takes the job anyway, so a job always starts.
- **Files:** before a run, the worker's copy of the project is brought up to date over rsync (what git tracks, plus `.env*`). Dependencies are installed on the worker when the lock file changes; `node_modules`, `target`, `.venv` and the like are never copied.
- **Tools:** a tool missing on a worker is installed there the way it is installed on the master (Homebrew, mise, rustup, cargo, npm -g, uv, pipx), in the background. Meanwhile the job runs elsewhere.
- **Dev servers** stay on the computer they started on, and their ports open on the master's `localhost`.
- **Docker** jobs use a worker's engine (OrbStack or Docker Desktop). The ports the containers publish come back to the master.
- Everything goes over ssh. Nothing is installed on the workers: a small agent (one Python file) is sent on connect.

## Set it up

1. On the Mac you work on, install it:

   ```sh
   brew install hivemux/tap/hivemux-swarm
   ```

2. Add a worker. This prints one line (also copied to the clipboard) and waits:

   ```sh
   hivemux-swarm add
   ```

   Paste that line into Terminal on the other Mac. It lets swarm's own key in, opens Sharing settings if **Remote Login** is off, asks for the Xcode command line tools if they are missing, and tells the master its address. Your `~/.ssh` on the master is not touched, and nothing downloaded is run. If you already ssh into that Mac without a password, `hivemux-swarm add me@spare-mac.local` works too.

   Getting the line onto a Mac signed in to another Apple account is the awkward part, so there are two other ways:

   - **AirDrop:** `hivemux-swarm add --airdrop` opens the AirDrop window with the line in a text file. Open the file on the other Mac and paste the line into Terminal.
   - **join:** while the master waits in `hivemux-swarm add`, install swarm on the other Mac and run `join` there. It finds the master on the local network (Bonjour), both Macs show the same 6 digits, and you press `y` on each. The digits come from the master's key and a number from each side, so nobody in between can make them match.

     ```sh
     brew install hivemux/tap/hivemux-swarm
     hivemux-swarm join               # or: hivemux-swarm join 192.168.0.10 when the network hides the master
     ```

3. Turn a project on and install the hook:

   ```sh
   cd ~/project/shop && hivemux-swarm on
   hivemux-swarm hook install
   ```

   Claude Code sessions started from then on use it. Sessions that were already open keep running commands where they are.

4. Check every computer:

   ```sh
   hivemux-swarm status
   ```

   It is a live screen: each computer's CPU and memory as bars, with a `│` where swarm's limit ends and dim cells for the part kept for that Mac's owner. `--once` prints it one time; `--json` and piped output stay plain text for scripts.

## Language

Everything swarm shows follows each Mac's language setting: English, Korean, Japanese, Chinese (Simplified), German, French or Spanish (the same languages as hivemux), and English for any other language. The master and every worker go by their own Mac's setting. To choose one, set `HIVEMUX_SWARM_LANG=en` (or `ko`, `ja`, `zh`, `de`, `fr`, `es`). Logs, `status --json` and piped output stay in English.

Adding a language takes one file: copy `share/lang/ko.json` to `share/lang/XX.json` and translate the values. Anything left out shows in English, and workers get the file with the agent.

## What is sent and what is not

- Only the files git tracks, plus `.env*` files. Sending `.env*` can be turned off per project with `[files] env = false` in `.hivemux-swarm.toml`.
- Light commands (`ls`, `git` and the like) and projects you did not turn on stay on the master.
- On a worker, copies live under `~/hivemux-swarm.noindex/`, apart from that Mac's own folders, and Spotlight does not index them. The worker's own files are never touched. Copies unused for 14 days are removed.

## Permissions

Claude Code checks its permission rules against the command a hook returns. swarm therefore says "allow" only when your rules allowed the original command; otherwise Claude Code asks as it always does. A command your deny rules match is never rewritten. In auto mode the decision is left to auto mode.

To run one command on the master, put `HIVEMUX_SWARM=0` in front of it.

## When something goes wrong

- Workers never talk to each other. Each has its own connections, copy and time limits.
- A worker that goes away mid-run: its tests and builds start again on another computer. Dev servers report it.
- The scheduler stuck or gone: commands run on the master, as if swarm were not installed.
- The master gone: workers end every process the jobs started.
- `hivemux-swarm doctor` checks connections, tools, copies, the hook and the scheduler.

## On a worker

`hivemux-swarm-worker` shows, live, what swarm is doing on that Mac: whether the master is connected, the jobs running (project, time, CPU, memory, command), installs in progress, copies, and the jobs that finished. It is meant for the person who uses that Mac; `q` or Esc leaves, and the jobs keep running.

[Image: hivemux-swarm-worker on the Mac mini: connected to the master, running npm run dev and npm test, with this Mac's CPU and memory]

## Commands

| Command | What it does |
|---|---|
| `hivemux-swarm add [HOST]` | add a worker (without HOST: print one line to paste on it and wait for `join`; `--airdrop` sends the line with AirDrop) |
| `hivemux-swarm join [MASTER]` | on the new Mac: find the master, match 6 digits, let it in |
| `hivemux-swarm remove NAME` | drop a worker and the copies on it |
| `hivemux-swarm on [DIR]` / `off [DIR]` | let the hook send a project's commands out, or stop |
| `hivemux-swarm run -c 'CMD'` | run one command where there is room (`--on NAME` to pick the computer) |
| `hivemux-swarm status [--once\|--json]` | every computer: load, memory, disk, jobs, queue, copies, installs, ports |
| `hivemux-swarm doctor` | check connections, tools, copies, the hook and the scheduler |
| `hivemux-swarm hook install` / `uninstall` | the PreToolUse hook in `~/.claude/settings.json` |

With hivemux installed, `hivemux swarm ...` does the same. The full reference and settings are in the [README](https://github.com/hivemux/hivemux-swarm#readme).

## Remove it

```sh
hivemux-swarm hook uninstall
hivemux-swarm remove NAME        # for each worker
brew uninstall hivemux-swarm
```
