# Remote workrooms

> Run workrooms on cloud machines, local containers or an existing SSH host, and keep working in the same app.

A remote workroom is a workroom whose files, terminals and coding agents live on a host instead of on your Mac. You still use it from Workroom's window, with the same tabs, splits, inspector and notifications.

boxd, exe.dev and container workrooms each get a fresh host of their own. SSH workrooms use a
Linux server you already have, with a separate folder for each workroom and several workrooms
on one server.

## Choose a host

You choose where a workroom goes when you create it. Click the **+** on a project in the sidebar, or right-click the project and choose **New Workroom**, or press <kbd>⌘N</kbd> and pick a project. Each of these asks where the workroom should go:

| Choice | What you get | Page |
| --- | --- | --- |
| **This Mac** | A normal workroom, a git worktree on your Mac. Not a remote workroom. | [Workrooms](/docs/app/workrooms.md) |
| **Docker** | A container on this Mac, run by Docker Desktop, OrbStack or Colima. | [Containers](/docs/remote/containers.md) |
| **Apple Container** | A container on this Mac, run by Apple's `container` tool. | [Containers](/docs/remote/containers.md) |
| **boxd** | A machine in the boxd cloud. | [boxd](/docs/remote/boxd.md) |
| **exe.dev** | A VM in the exe.dev cloud. | [exe.dev](/docs/remote/exe-dev.md) |
| **Railway** | A sandbox in your Railway account. | [Railway](/docs/remote/railway.md) |
| **SSH** | A folder on a Linux server you already reach with ssh. | [SSH hosts](/docs/remote/ssh.md) |

In the menu, Docker and Apple Container sit under **Local containers**, and boxd, exe.dev, Railway and SSH sit under **Remote**. A choice that cannot be used right now is dimmed, and says why next to its name. For example, a container runtime that is not installed says `not installed`.

## What a project needs

A remote workroom is always a workroom of a project that is on your Mac. You cannot add a project that exists only on a host.

- The project's `origin` must be on github.com. Workroom clones the repository on the host from `origin`, and reads pull request status through your Mac's `gh`.
- The workroom's base branch must be on `origin`. A remote workroom cannot start from a branch that only exists on your Mac, or on a remote other than `origin`. If it cannot, the create stops and tells you to push the branch or change the project's base branch in **Settings ▸ Projects**.
- Only pushed work reaches the host. Changes and commits that are only on your Mac do not appear in a remote workroom until you push them.

## What runs where

Workroom starts a small program on every host, the Workroom daemon (`workroom serve`). It keeps your terminal sessions running, and answers the questions the inspector asks about the repository: history, changes and files.

Your terminals are sessions on the host, not processes on your Mac. A dev server or a coding agent keeps running when you quit Workroom, close the window or lose your network. When you come back, your tabs attach to the same sessions. See [Reconnecting](/docs/remote/reconnecting.md).

The project's run command runs on the host too, in its own tab. See [Run on a remote workroom](/docs/app/terminals-and-tabs.md#run-on-a-remote-workroom).

### `workroom` in a host's terminals

The program on the host is the same `workroom` as on your Mac, and `workroom --help` lists the same commands. Every terminal of a remote workroom has `workroom` first on its `PATH`, as on your Mac: it is the build of the Workroom daemon that runs the terminal, so its commands always match that daemon, even if you installed another `workroom` on the host. The folder it is in is in `WORKROOM_BIN_DIR`. A login profile can replace `PATH` (Debian's `/etc/profile` does): in zsh, fish, and bash in a pane that uses Ghostty's terminal type, Workroom puts the folder first again once your startup files have run, and in elvish and nu Ghostty's terminal adds it back at the end; in other shells, such as `sh` or `dash`, run it as `"$WORKROOM_BIN_DIR/workroom"`, or add `export PATH="$WORKROOM_BIN_DIR:$PATH"` to the end of your profile. To keep your own `PATH` order, unset `WORKROOM_BIN_DIR` in a startup file. A setup or teardown script has the `workroom` that runs it on its `PATH`, after your own entries. See [Environment variables](/docs/reference/environment-variables.md#variables-your-terminals-receive). Commands that need your Mac, such as `create`, `delete` and `add-project`, are marked "(Mac only)" and say so when run on a host, with the error kind `MacOnly`. `workroom update` says the app keeps it up to date, with the kind `ManagedInstall`: Workroom installs a newer one the next time it connects.

What stays on your Mac:

- The app itself, your windows and your settings.
- The `gh` sign-in that Workroom uses for pull requests and CI.
- A container's GitHub access. A Docker or Apple container gets its GitHub credentials from your Mac's `gh`, while you have Workroom open. boxd and exe.dev hosts use GitHub access you set up with the provider, so they keep working with your Mac closed.

An SSH host uses the GitHub credentials you set up on that server. The app's Git commands on every
kind of remote host use that host user's login-shell environment, so they can find tools and
credentials from the user's profile.

The **Details** pane in the inspector shows where a workroom runs: **Running on**, **Machine Name** (the name the host is listed under, in boxd's or exe.dev's dashboard or in `docker ps`) or **Host** (the SSH destination), and **Path on its host**. Open it with <kbd>⌥⌘I</kbd>. See [Details and ports](/docs/app/details-and-ports.md).

## Create one

When you pick a host, the workroom's pane opens at once with a checklist. It shows each step of the create with its time, and a log you can open:

- A container: **Check repository**, **Read devcontainer.json**, **Run initializeCommand**, **Pull image**, **Build image**, **Start container**, **Connect**, **Clone repository**, **Check out branch**, then your `devcontainer.json`'s lifecycle commands after **Copy local files**. See [Docker and Apple containers](/docs/remote/containers.md#create-a-container-workroom).
- boxd: **Check repository**, **Check boxd account**, **Create machine**, **Set up machine**, **Connect**, **Clone repository**, **Check out branch**. A machine made from a snapshot also shows **Restarting host from snapshot** after **Set up machine**.
- exe.dev: **Check repository**, **Check exe.dev account**, **Create VM**, **Wait for boot**, **Set up machine**, **Connect**, **Clone repository**, **Check out branch**.
- SSH: enter the host and parent folder, check the host and its key, then make the workroom's
  folder, connect, clone the repository and check out the branch. See [SSH hosts](/docs/remote/ssh.md).

After these, **Copy local files** runs if your project has a `.worktreeinclude`, and **Run setup script** runs if it has a `scripts/workroom_setup`. If a step fails, the pane tells you why and offers **Try Again** or **Close**. If the failed create could not take its machine down, the pane says the machine is still running and offers **Delete Workroom…** or **Close** instead.

The first time you use boxd or exe.dev, the **Check ... account** step waits for you while a setup sheet walks you through signing up. See [boxd](/docs/remote/boxd.md) and [exe.dev](/docs/remote/exe-dev.md).

## Choose a host's image and size

A boxd, exe.dev or Railway workroom's host can start from your own image and have the size you choose. On boxd the image is a snapshot of one of your machines. On exe.dev it is a container image. On Railway it is a checkpoint, and you also choose the region: see [Region, size and checkpoint](/docs/remote/railway.md#region-size-and-checkpoint).

You can choose them in three places, and the most specific one wins, setting by setting:

1. **For one workroom.** In the **New Workroom** dialog, click the **Configure** button (sliders icon) beside **boxd** or **exe.dev**, or highlight it and press <kbd>⌘⏎</kbd>. From the sidebar's **New Workroom** menu, choose **boxd ▸ Configure…** or **exe.dev ▸ Configure…**, which opens the dialog at the same step. Their **Create** creates at once, as picking the place in the dialog does. The dialog shows that it is loading while Workroom reads the provider's images and sizes, then what each setting will be and where it comes from. Turn on **Remember for this project** to save the settings you changed to the project. Click **Create Workroom**. If Workroom can't read the provider's images and sizes, for example because the provider isn't set up yet, the dialog shows why instead. Click the back button to return to the places.
2. **For one project.** In [Settings ▸ Projects](/docs/app/settings.md#projects), with the same choices as Remote Hosts. The provider's own default is marked **(default)**, and a value from Settings **(app)**. Choosing the value marked **(app)**, or leaving a field empty, follows Settings, so a later change there applies to the project too. Where Settings names its own value, the **(default)** choice gets the provider's default instead.
3. **For every project.** In [Settings ▸ Remote Hosts](/docs/app/settings.md#remote-hosts).

Picking **boxd** or **exe.dev** in the dialog still creates the workroom at once, with these settings.

A machine made from a snapshot of a used workroom starts clean: none of that workroom's terminals, pane layouts or checkout come with it. The new workroom gets a fresh clone. Anything installed outside the checkout, such as your toolchain, stays.

An exe.dev image has to boot systemd and have `sudo`, `git` and the `exedev` user, as exe.dev's own `ghcr.io/boldsoftware/exeuntu` does. Name the image with its registry: without one, exe.dev looks on Docker Hub. If it doesn't, the create fails at **Wait for boot** or **Set up machine** and names the image. A size your plan doesn't allow fails with exe.dev's own message.

When a create with your own image or size fails while making, restarting or setting up its host, the pane also offers **Try With Provider Defaults**. It creates the workroom again on the provider's default image and size, and changes none of your settings. **Try Again** keeps the settings that create used.

## Setup and teardown scripts

Your project's `scripts/workroom_setup` and `scripts/workroom_teardown` run on the host, inside the clone. They behave as they do on your Mac, apart from these differences:

- `WORKROOM_HOST` tells the script where it runs: `boxd`, `exedev`, `docker`, `apple` or `ssh`. On your Mac it is `local`.
- `WORKROOM_ROOT_PATH` is not set. There is no root project on a host. A script that copies a file from the root has to check first:

  ```sh
  if [ -n "${WORKROOM_ROOT_PATH:-}" ]; then
    cp "$WORKROOM_ROOT_PATH/.env" .env
  fi
  ```

  With `set -u`, an unguarded `$WORKROOM_ROOT_PATH` fails the script, and so the create. To bring gitignored files such as `.env` to the host, list them in `.worktreeinclude` instead.
- The script gets the host user's login environment, never your Mac's. Your Mac's secrets stay on your Mac.
- You approve the script on your Mac before it runs, as for any workroom. See [Prepare a project](/docs/guides/prepare-a-project.md).

See [Environment variables](/docs/reference/environment-variables.md) for the full list.

If the setup script fails, the workroom is kept until you choose. The pane offers **Open Anyway** or **Delete Workroom…**.

A remote create asks about a new or changed setup script when the script is about to run, after the host is made and the repository cloned. The create waits at **Run setup script** with the script in a sheet. **Approve** runs it on the host. **Continue Without Script…** carries on without it. **Not Now** puts the sheet away and leaves the create waiting. In the pane, **Review Script…** opens the sheet again, and **Cancel Creation** deletes the workroom and its host. A container's `devcontainer.json` is still approved before the container is made.

If Workroom quits, or you close the create's pane, while the script waits, the workroom stays. Its sidebar row shows a warning sign, and its Details pane says **Setup script not run**, with **Review Script…**, **Continue Without Script…** and **Delete Workroom…**. Its host keeps running until you choose.

## Delete a remote workroom

Deleting a boxd, exe.dev or container workroom destroys its host and everything on it, including
changes and commits that were not pushed. The confirmation says so.

1. Run the project's teardown script on the host, if there is one.
2. Destroy the host.
3. Remove the workroom from Workroom.

If the teardown script fails, can't start, runs out of time, or the host can't be reached, the delete stops and the host stays. Its terminals in Workroom were closed before the script ran. Workroom shows why, with the script's output, and offers **Delete Anyway**, which deletes without the script.

If destroying the host fails part of the way, the workroom stays in the sidebar, so you can delete it again to finish the job.

Deleting an SSH workroom runs its teardown, ends only its sessions, then removes its folder when
the folder's marker matches. The server and its other folders stay. If the host is unreachable or
the marker is missing or different, the delete stops; **Delete Anyway** forgets the workroom and
names the folder left behind. See [Delete an SSH workroom](/docs/remote/ssh.md#delete-a-workroom).

Delete a remote workroom in the app. The `workroom delete` command refuses a remote workroom whose
host is still recorded as running. Deleting a project also deletes its remote workrooms,
whichever option you pick, with the same rules for each host kind.

> [!NOTE]
> Workroom does not put a host to sleep. Whether a cloud host sleeps is up to you and the provider.
> A provider host exists until you delete its workroom. An SSH server stays after deletion.

Workroom starts a Docker or Apple container when you open its workroom and it isn't running.

## Release and Nightly

Release and Nightly share one config, so each can open and delete the other's boxd, exe.dev and SSH
workrooms. They share the daemon on an SSH host too; an older build keeps a newer daemon already
running there. A container belongs to the build that made it. If a workroom runs on a container
another build made, deleting it from this build is refused, and the message names that build.
