---
title: "Run a Rex server on a remote Linux VM"
description: "Run the Rex server (beta) on an always-on exe.dev VM and add it to Rex for Mac over SSH: sessions and agents keep running when your Mac sleeps."
url: https://exe-staging.dev/deploy/rex
category: "AI agents"
updated: 2026-11-16
---

# Run a Rex server on a remote Linux VM

An always-on remote host for Rex, with agents ready and no API keys.

- **Software:** Rex (https://www.superlogical.com/rex)
- **License:** Proprietary (free beta)
- **Time:** 5 minutes
- **Example VM name:** `my-rex` (yours will differ; on the VM, `hostname` prints it)
- **Machine-readable:** https://exe-staging.dev/deploy/rex/manifest.json

## What you get

- Rex's Linux server from the preview channel, running as `exedev` and back after a reboot
- Rex for Mac reaching it over SSH, with the key you already use for exe.dev
- Claude Code and Codex using exe.dev's LLM integration, with Rex's agent skill installed
- A Rex session `work` in `~/project` where Claude Code answers `OK`

Running on the VM:

- **Rex server**: the rex package (0.1.0 preview), a personal server run as your account by systemd, data in `~/.local/state/rex`
- **Claude Code and Codex**: preinstalled; connected to exe.dev's LLM integration, with Rex's agent skill, data in `~/.claude, ~/.codex`
- **Your project**, data in `~/project`

How it is reached:

- ssh://my-rex.exe.xyz (private): the Rex server, for Rex for Mac and the rex command; your exe.dev SSH key gets you in
- ssh my-rex.exe.xyz (private): your terminal

## Deploy with Shelley

Open https://exe-staging.dev/new?prompt=Set%20up%20Rex%20on%20this%20VM%20by%20following%20the%20exe.dev%20recipe%20at%20https%3A%2F%2Fexe-staging.dev%2Fdeploy%2Frex.md%20from%20top%20to%20bottom.%0A%0AThe%20recipe%27s%20example%20VM%20name%20is%20my-rex.%20This%20VM%27s%20name%20is%20the%20output%20of%20%60hostname%60%3A%20use%20it%20wherever%20the%20recipe%20writes%20my-rex.%20Skip%20the%20step%20that%20creates%20the%20VM%3B%20you%20are%20on%20it.%0A%0AYou%20are%20done%20when%20all%20of%20these%20are%20true.%20Check%20each%20one%20yourself%3A%0A-%20Rex%27s%20Linux%20server%20from%20the%20preview%20channel%2C%20running%20as%20%60exedev%60%20and%20back%20after%20a%20reboot%0A-%20Rex%20for%20Mac%20reaching%20it%20over%20SSH%2C%20with%20the%20key%20you%20already%20use%20for%20exe.dev%0A-%20Claude%20Code%20and%20Codex%20using%20exe.dev%27s%20LLM%20integration%2C%20with%20Rex%27s%20agent%20skill%20installed%0A-%20A%20Rex%20session%20%60work%60%20in%20%60~%2Fproject%60%20where%20Claude%20Code%20answers%20%60OK%60%0A%0ARun%20the%20VM-side%20commands%20in%20%22Set%20up%20the%20VM%22%20only%3B%20skip%20creating%20the%20VM.%0AIf%20%60exeuntu%20configure%60%20reports%20an%20existing%20user%20config%2C%20leave%20it%20alone.%0AIf%20%60~%2Fproject%60%20already%20exists%2C%20leave%20it%20alone.%20Don%27t%20start%20interactive%0Aagents.%20Verify%20with%20the%20checks%20at%20the%20end%20of%20that%20section%3A%20%60rex%20version%60%0Astarts%20with%20%60rex%200.1.0%60%2C%20%60rex%20server%20status%60%20shows%20%60exit-empty%3A%20false%60%2C%0Aand%20the%20%60work%60%20session%20shows%20%60OK%60%20from%20Claude%20Code.%20Skip%20the%20later%0Asections%20and%20the%20FAQ.%20Finish%20by%20telling%20the%20owner%20to%20run%0A%60ssh%20%3Cthis%20VM%27s%20name%3E.exe.xyz%20rex%20version%60%20on%20their%20Mac%2C%20then%20add%0A%60ssh%3A%2F%2F%3Cthis%20VM%27s%20name%3E.exe.xyz%60%20in%20Rex%20for%20Mac%20with%0A%2A%2AAdd%20Remote%20Host%E2%80%A6%2A%2A%20%28%22Add%20it%20to%20Rex%20for%20Mac%22%29.%20Never%20put%20Rex%20behind%0Aexe.dev%27s%20HTTPS%20proxy%20or%20use%20%60--allow-anonymous%60.%0A%0AFinish%20with%20the%20URLs%20I%20should%20open.%0A to create a VM whose agent, Shelley, follows this recipe. From a terminal:

```sh
curl -fsSL https://exe-staging.dev/deploy/rex/prompt.txt | ssh exe.dev new --prompt=/dev/stdin
```

Or follow the steps below by hand.

[Rex](https://www.superlogical.com/rex) is a terminal multiplexer from
Superlogical, Mitchell Hashimoto's new company. Sessions live in a Rex
server, not in the window, and Rex for Mac can attach to servers on other
machines. Run one on an exe.dev VM and your shells and agents keep going
when your Mac sleeps.

Rex connects to remote servers over SSH, so your exe.dev key is all it
needs. Claude Code and Codex on the VM use exe.dev's
[LLM integration](/docs/integrations-llm), so there are no API keys to
manage.

> [!WARNING]
> Rex is in beta, and you need a Rex for Mac tester build. Rex has no
> logins of its own yet; it trusts SSH to say who you are. Don't put it
> behind the HTTPS proxy.

## Set up the VM

Create a VM and log in. Skip the first line if you already have one:

```bash
ssh exe.dev new --name=my-rex
ssh my-rex.exe.xyz
```

On the VM, connect the agents to the LLM integration and install Rex from
the preview channel. (Without `--channel`, the script installs a snapshot
build, since there's no stable release yet.)

```bash
exeuntu configure claude
exeuntu configure codex
curl -fsSL https://pkgs.superlogical.com/rex/install.sh | sh -s -- --channel preview
rex version
```

Start a personal server, run by systemd as `exedev`. exe.dev's SSH
sessions don't set `XDG_RUNTIME_DIR`, which `rex server install` needs:

```bash
XDG_RUNTIME_DIR=/run/user/$(id -u) rex server install
```

Teach the agents Rex's commands, and open a session in a new project:

```bash
rex skill setup
git init ~/project
rex new work -c ~/project
```

Check that it works. Claude Code should print `OK` in the `work` session:

```bash
rex server status | grep -E '^(version|exit-empty)'
rex send -s work 'claude -p --model haiku "Reply with exactly: OK"'
rex send-key -s work Enter
sleep 20; rex capture -s work | tail -3
```

## Add it to Rex for Mac

On your Mac, check that SSH works and finds `rex`. This also accepts the
VM's host key:

```bash
ssh my-rex.exe.xyz rex version
```

In Rex for Mac, choose **Add Remote Host…** and enter:

```
ssh://my-rex.exe.xyz
```

Rex uses your Mac's `ssh`, keys and `~/.ssh/config`. exe.dev logs every
SSH user in as `exedev`, so you can leave the user name out.

Open the `work` session and start an agent:

```bash
cd ~/project && claude
```

Give it a task and close the laptop. It keeps working. Codex works too;
approve Rex's hook with `/hooks` the first time.

From a terminal on your Mac:

```bash
rex hosts add my-rex ssh://my-rex.exe.xyz
rex -S my-rex ls
```

We tested the `rex` command over SSH. We couldn't run Rex for Mac, but it
takes the same address.

## Let agents drive Rex

With the skill installed, an agent in Rex can open tabs, split panes and
read other terminals. Ask it to "start the dev server in another tab" or
"run the tests beside you and fix what fails", and watch. Shelley, at
`https://my-rex.shelley.exe.xyz/`, uses the same skill. See Rex's
[agent docs](https://www.superlogical.com/rex/docs/automate/agent-skill).

Serve previews on port 8000 and open `https://my-rex.exe.xyz/`. It's
private until you [share it](/docs/sharing).

## Prefer Tailscale?

You don't need it, but Rex can join your tailnet itself; the VM doesn't
need Tailscale installed. Turn on **MagicDNS** and **HTTPS Certificates**
for your tailnet, then on the VM (this restarts the server, ending programs
running in Rex):

```bash
export XDG_RUNTIME_DIR=/run/user/$(id -u)
mkdir -p ~/.config/systemd/user/rex.service.d
cat > ~/.config/systemd/user/rex.service.d/tailscale.conf <<EOF
[Service]
ExecStart=
ExecStart=/usr/bin/rex server run --log-format text --tailscale --tailscale-hostname $(hostname)
EOF
systemctl --user daemon-reload
systemctl --user restart rex.service
rex server status
```

Open the `authenticate:` link and approve the device. Then add
`https://my-rex.<your-tailnet>.ts.net` in Rex for Mac. See
[Remote Access](https://www.superlogical.com/rex/docs/linux/remote-access#who-can-connect)
for who can connect.

## What keeps running

- **Your Mac sleeps:** nothing on the VM notices.
- **The VM restarts:** sessions, tabs and panes come back, with fresh
  shells. Programs that were running are gone.
- **Rex updates:** the running server keeps the old version until you
  restart it.

## Back up and restore

Push your code. To copy the whole VM:

```bash
ssh exe.dev cp my-rex my-rex-backup
```

If you use Tailscale, the copy shares the original's Tailscale identity.
On the copy, delete `~/.local/state/rex/tsnet`, change the name in the
drop-in, and restart the server.

## Update

```bash
curl -fsSL https://pkgs.superlogical.com/rex/install.sh | sh -s -- --channel preview
rex version | head -1
rex server status | grep '^version'
```

If the versions differ, run `rex server stop` when nothing important is
running. The next connection starts the new version. Update the agents
with `sudo exeuntu update claude` and `sudo exeuntu update codex`.

## Troubleshooting

- **`rex server install` can't reach systemd's user manager:** put
  `XDG_RUNTIME_DIR=/run/user/$(id -u)` in front.
- **Rex for Mac can't connect:** run `ssh my-rex.exe.xyz rex version` on
  your Mac. If SSH asks for a passphrase, run `ssh-add`; Rex can't prompt.
- **`rex` says `(R)?ex`:** that's an unrelated Ubuntu package. Run the
  install script again.
- **The server won't start:** see `journalctl --user -u rex`, or the log
  path in `rex server status`.
- **An agent doesn't answer:** try `claude -p "Reply with exactly: OK"`
  on the VM, and rerun `exeuntu configure claude` if it fails.

More in Rex's
[Linux docs](https://www.superlogical.com/rex/docs/linux/installation).

## Frequently asked questions

### Can I use Rex yet?

It's in public testing. Rex for Mac goes out in waves to Superlogical's [mailing list](https://www.superlogical.com/rex). The Linux server is open to all testers and installs without an account. The iOS, Linux and Windows clients aren't in public testing yet. Expect things to change between builds.

### Can I use exe.dev's HTTPS proxy instead of SSH?

No. Rex has no logins yet, so an HTTP listener needs `--allow-anonymous`, and then anyone who connects can run programs as you. Use SSH, or [Tailscale](#prefer-tailscale).

### Why the personal server?

It runs as `exedev`, the account with your files and agent configs, and it's the one Rex finds over SSH. The shared server runs as a separate `rex` account and loses its sessions on upgrade. For several people, see Rex's [login server](https://www.superlogical.com/rex/docs/linux/login-server).

### Can I use my own Claude or ChatGPT subscription?

Yes. Remove what `exeuntu configure` added (`apiKeyHelper` and `env.ANTHROPIC_BASE_URL` in `~/.claude/settings.json`, the `exe-llm` provider in `~/.codex/config.toml`), then run `claude auth login` or `codex login`. Keep the `hooks` entries Rex added.

### How much does it cost?

Rex is free, and Superlogical says it will stay free. The VM is part of your exe.dev plan, and model usage through the [LLM integration](/docs/integrations-llm) is billed to your exe.dev account.

### Does Rex send data anywhere?

Rex [collects no telemetry](https://www.superlogical.com/rex/docs/reference/privacy). The VM talks to Superlogical's package repository for updates, and to Tailscale only if you turn it on.


## Related

- [Run Herdr agents on a remote machine](https://exe-staging.dev/deploy/herdr.md): An always-on SSH machine for Herdr, with agents ready and no API keys.
- [Run Orca's agents on a remote server](https://exe-staging.dev/deploy/orca.md): A big, always-on box for Orca's parallel coding agents.
- [Run Claude Code on a remote server](https://exe-staging.dev/deploy/claude-code.md): A computer for Claude. A breather for your laptop.
- [Run Codex on a remote server](https://exe-staging.dev/deploy/codex.md): A computer for Codex. An early night for your laptop.
- [Run T3 Code on a remote server](https://exe-staging.dev/deploy/t3code.md): Your coding agents on an always-on VM, steered from your phone.
- [Host OpenClaw](https://exe-staging.dev/deploy/openclaw.md): An AI sidekick with its own computer. Your laptop can take a nap.
