# Run your agents on a Linux server and close your laptop

> Put a lead and its crew on a Linux server you own or rent, so they can keep working while your Mac sleeps. You sign them in from your Mac.

- **Category:** Setup and safety
- **Updated:** 2026-12-01
- **Reading time:** 5 min
- **Canonical page:** https://cmdbrief.com/guides/run-agents-on-a-linux-server

## What you get

- **Your Mac:** You brief and decide; Shows the server’s workspaces; Answers its requests
- **Linux agent server:** The lead and its crew; Their CLI sign-ins; Can keep working while the Mac sleeps
- **Your Mac → Linux agent server:** briefs and answers
- **Linux agent server → Your Mac:** work and requests
- **Connection:** A direct line: the same network, or Tailscale on both

CmdBrief runs on the server with no window, as a service. Your Mac shows that server’s workspaces, leads and requests next to its own, and you start a lead there from the Mac. The lead and its crew run on the server, so they can keep working when your Mac sleeps or the lid is closed. When the Mac wakes, it catches up.

> **Warning:** The agent CLIs sign in on the server, so their sign-ins live on its disk. If you only want builds and tests off your Mac, a [build machine](https://cmdbrief.com/guides/linux-build-machine) needs no sign-in there.

> **Tip:** Agents setting this up for someone: follow the steps in order. The steps marked “You do this” need the person; ask them and wait.

## Before you start

- A Linux server on 64-bit Intel or AMD (x86_64) with glibc 2.35 or newer (Ubuntu 22.04, Debian 12 or later) and systemd.
- A network the Mac and the server share, or [Tailscale](https://tailscale.com/kb/1017/install) on both.
- CmdBrief signed in on your Mac.
- A terminal on the server for you (SSH is fine). An agent can do the checks and installs over SSH, but signing in and pairing need you.

## Install the agent CLIs

**Step 1 of 5 · An agent can do this** (On the server, or over SSH)

**On the server**

```bash
uname -m                     # x86_64
ldd --version | head -1      # 2.35 or newer
npm i -g @anthropic-ai/claude-code @openai/codex
```

Add `gh` too if the lead will clone from GitHub. Install only the CLIs you will use there.

**Check it worked**

| Where | Run or do | Pass |
| --- | --- | --- |
| Server | `claude --version; codex --version` | Each CLI you installed prints its version. |

## Install CmdBrief and sign in

**Step 2 of 5 · You do this** (In your own terminal on the server)

**On the server**

```bash
curl -fsSL https://cmdbrief.com/install.sh | sh
```

It installs CmdBrief in `~/.local/bin`, runs it as a user service, signs the server in with the code from your email, turns sharing on and shows the code to pair. When it says another computer must approve this one, approve it on your Mac in Settings › Computers.

Or step by step: download `CmdBrief-*-linux-x86_64.tar.gz` from [the Linux download](https://cmdbrief.com/api/v1/app-download?platform=linux-x86_64), then:

**On the server, step by step**

```bash
tar -xzf CmdBrief-*-linux-x86_64.tar.gz
cd CmdBrief-*-linux-x86_64 && ./install.sh
cmdbrief login                       # type the code from your email
cmdbrief service install             # keep it running as a user service
sudo loginctl enable-linger $USER    # keep it running after you log out
cmdbrief share on                    # let your other computers see it
cmdbrief remote-host on              # optional: auto-resume interrupted agents after restarts
```

Automatic resume after a restart is **off by default**, even under `cmdbrief serve`. If you want interrupted agents to pick back up on their own after a reboot or update, run `cmdbrief remote-host on` in your terminal or SSH session (which enables **Resume interrupted agents on launch**, cold-chat fresh starts, and sharing), or turn on **Resume interrupted agents on launch** alone in Settings › Conversations.

**Check it worked**

| Where | Run or do | Pass |
| --- | --- | --- |
| Server | `systemctl --user is-active cmdbrief` | It prints `active`. |
| Server | `loginctl show-user "$USER" -p Linger` | It prints `Linger=yes`. |

## Pair it with your Mac

**Step 3 of 5 · You do this** (On your Mac, with the server’s terminal open)

1. On the Mac, open Settings › Computers, find the server, and choose **Pair with a code…** from its More menu.
2. On the server, run `cmdbrief pair`. It prints who is asking and a 6-digit code; type the code on the Mac. Pairing codes are for your eyes: CmdBrief keeps them away from agents.
3. Keep **Full use** (the default for `cmdbrief pair`), so the Mac can open the server’s terminals, agents and files and start leads there.

**Check it worked**

| Where | Run or do | Pass |
| --- | --- | --- |
| Server | `cmdbrief computers` | Your Mac is listed with full use and a direct line. |

## Sign the agent CLIs in from your Mac

**Step 4 of 5 · You do this** (On your Mac, in Settings › Computers)

Open Settings › Computers › the server › Setup and press **Sign in** on each agent’s row. The server runs that CLI’s own sign-in, and the Mac shows its terminal with **Open sign-in page**.

- Codex: open the page, sign in, and type the code the terminal shows into the page.
- Claude Code: open the page, sign in, copy the code the page shows, paste it into the terminal in the sheet, and press Enter.
- GitHub, if the lead clones from it: run `gh auth login` in your terminal on the server.

The sheet closes when the CLI says it is signed in. Your sign-ins are never copied between computers.

**Check it worked**

| Where | Run or do | Pass |
| --- | --- | --- |
| Mac | Look at Settings › Computers › the server › Setup | Each agent you use shows as signed in. |

## Start a lead there

**Step 5 of 5 · An agent can do this** (On your Mac)

A lead on your Mac can suggest one: it lists your computers, then shows a card with the server, the agent and the brief.

> **You do this (On your Mac):**
> 1. Press **Start** on the card. Or use **Start a project…**, set Computer to the server, pick a folder or a repository, and write the brief.

**Check it worked**

| Where | Run or do | Pass |
| --- | --- | --- |
| Server | `cmdbrief status` | The lead is listed and working. |
| Mac | Close the lid for ten minutes, then open it | The lead’s work went on, and the Mac shows it. |

## If it fails

| What it says | Fix |
| --- | --- |
| “GitHub isn’t signed in on server. Run gh auth login there.” | **You:** Run `gh auth login` in your terminal on the server. |
| An agent’s row says it isn’t signed in | **You:** Press Sign in on that row from the Mac. |
| The server goes offline when you log out of SSH | Linger is off: `sudo loginctl enable-linger $USER`. |
| The Mac says “Connect both to the same network or to Tailscale” | Bring up Tailscale on both computers, or put them on one network. |
| `cmdbrief serve` exits with code 3 | Another CmdBrief runs on the same profile there. Keep only the service. |
| Agents stopped when the server restarted | **You:** Automatic resume is off by default, even under `cmdbrief serve`: interrupted agents stay recorded until you press **Continue** or **Resume lead & crew** from your Mac. To resume automatically after future restarts, turn on **Resume interrupted agents on launch** in Settings › Conversations, or enable Remote host with `cmdbrief remote-host on` in your terminal or SSH session (also in Settings › Computers). |

## Undo

Sign each CLI out from the Mac with **Sign out** in one of the server’s agent panes. It asks first, because it signs out every session of that account on the server. Then unpair the server in Settings › Computers.

## Questions

### Can the agents keep working with my Mac closed?

Yes. They run on the server. The Mac shows their work again when it wakes.

### Where do my agent sign-ins live?

On the server, where the CLI keeps them. CmdBrief never copies them between computers.

### Should I use a build machine instead?

Use a build machine when you only want builds and tests off your Mac and no sign-ins elsewhere. Use an agent server when work must go on while your Mac sleeps.

## Primary sources

Provider terms and product behavior can change. Confirm plan, pricing, model, and permission details in the current official documentation.

- [Tailscale: install](https://tailscale.com/kb/1017/install)
- [systemd: loginctl enable-linger](https://www.freedesktop.org/software/systemd/man/latest/loginctl.html)
- [Claude Code setup](https://docs.anthropic.com/en/docs/claude-code/setup)
- [Codex CLI](https://github.com/openai/codex)

## Keep reading

- Setup and safety: [Add a Linux build machine for your Mac’s agents](https://cmdbrief.com/guides/linux-build-machine)
- Setup and safety: [Use CmdBrief on a rented cloud machine](https://cmdbrief.com/guides/cmdbrief-on-a-rented-machine)
- Setup and safety: [Claude Code sandbox and permissions: how to run it safely](https://cmdbrief.com/guides/claude-code-sandbox)

---

Markdown mirror of https://cmdbrief.com/guides/run-agents-on-a-linux-server, generated at build time from the same data the HTML page renders. Machine-readable index: https://cmdbrief.com/llms.txt
