Environment variables
The environment variables Workroom sets for your setup and teardown scripts, and the ones you can set to change how Workroom and its installer behave.
This page lists every environment variable Workroom sets for scripts, and every one you can set yourself.
Variables your scripts receive
Workroom sets these for both the setup script and the teardown script. The script's working directory is the workroom directory. Workroom sets them for you, so don't set them yourself.
| Variable | Value |
|---|---|
WORKROOM_NAME |
The name of the workroom being created or deleted. |
WORKROOM_PATH |
The absolute path of the workroom directory. |
WORKROOM_ROOT_PATH |
The absolute path of the root, the project the workroom belongs to. Scripts run inside the workroom, so use this to reach files in the root. |
WORKROOM_PARENT_DIR |
A deprecated alias for WORKROOM_ROOT_PATH, still set so existing scripts keep working. Use WORKROOM_ROOT_PATH in new scripts. |
WORKROOM_HOST |
Where the script runs: local on your Mac, or the kind of host for a remote workroom: boxd, exedev, railway, docker, apple or ssh. |
Scripts also receive the rest of the environment your login shell sets up in the workroom, such as anything you export in your dotfiles and the tool versions the workroom pins. See Prepare a project for writing the scripts.
On a remote host
A script for a remote workroom runs on its host, and the environment differs from a local one:
-
WORKROOM_ROOT_PATHandWORKROOM_PARENT_DIRare not set, because there is no root on the host. Guard any use of them:if [; then fiUnder
set -u, an unguarded$WORKROOM_ROOT_PATHfails the script, and so fails the create. -
The rest of the environment is what the host user's login shell sets up in the workroom, never your Mac's. Your Mac's environment, secrets included, stays on your Mac.
The app's Git commands on every kind of remote host also use that host user's login environment. The daemon reads it once and keeps it until it restarts. A login profile that fails or takes longer than 10 seconds falls back to the daemon's own environment, and the daemon logs why.
Variables your terminals receive
Every terminal pane's shell, on your Mac and on a remote host, gets these, so Workroom's commands run from that pane know where they're running. Workroom sets them when the pane starts, so don't set them yourself.
| Variable | Value |
|---|---|
WORKROOM_PANE |
The ID of the pane's terminal session. |
WORKROOM_DAEMON |
The path of the socket of the Workroom daemon that runs the pane. |
WORKROOM_BIN_DIR |
The folder that holds the workroom command of the daemon that runs the pane. It is the first entry of the pane's PATH. |
OSC7577_TOKEN |
The pane's secret for the Program Resume Protocol, new for every terminal: a program signs its report of how to start it again with it. Unset in a run tab, while Resume programs after a restart is off, and under a daemon running as root. Keep it secret, and don't pass it on over ssh. See Make your own program resume after a restart. |
The workroom in WORKROOM_BIN_DIR is the build of the daemon the pane talks to, so its commands always match that daemon. When the app updates, the same folder holds the new one, in panes that were already open too: at once when the daemon moves to the new build, and when the next terminal opens when only the commands changed. It comes ahead of any workroom you installed yourself.
A login profile can move the folder down PATH (macOS's path_helper does) or replace PATH (Debian's /etc/profile does). In zsh and fish, and in bash on a remote host whose pane uses Ghostty's terminal type, Workroom puts the folder first again once your startup files have run. In elvish and nu on a remote host, Ghostty's terminal adds it back at the end if your startup files took it off. Other shells, such as sh, dash and macOS's own /bin/bash, and a run tab's command, start with it first and keep what your profile does. A tool that changes PATH at every prompt, such as mise or direnv, can put its own folders ahead of it. If your dotfiles set PATH and you want the folder back, add this to the end of your profile:
[ &&
To keep your own PATH order instead, for example so that a workroom you build yourself comes first, unset the variable in a startup file. Workroom then leaves PATH as your startup files made it:
In fish, use set -e WORKROOM_BIN_DIR in config.fish.
Workroom finds the pane a command runs in from the command's process first, and uses WORKROOM_PANE only when that finds none. A tmux server keeps the variables of the pane it started in, so list them in tmux's update-environment option if you run tmux across panes.
These are what the workroom commands that drive terminals use. See Drive terminals from agents and scripts.
Variables you can set
WORKROOM_SHELL_PROBE
Workroom sets this to 1 while it reads your login shell's environment, so your shell startup file can skip slow work. The macOS app reads your environment each time it creates or deletes a workroom. Workroom reads it again in the workroom just before a setup or teardown script runs, on your Mac and on a remote host. The remote daemon also reads the login environment once for the app's Git commands. It is not passed on to your script.
In your .zshrc:
[ ||
Don't skip your version manager this way: your script needs it to pick the workroom's tool versions.
The read just before a script waits 10 seconds for the shell. If the shell doesn't finish or fails, the script still runs, with the environment Workroom already had, and its output says why. A .zshrc that ends with exec tmux, or waits for input, makes the shell fail. See Troubleshooting.
WORKROOM_CONFIG
The path of the config file to use in place of ~/.config/workroom/config.json. Workroom doesn't need it for normal use. A Dev build of the app sets it so it keeps its own config. See config.json.
EDITOR
When workroom create finishes in a terminal and EDITOR is set, it offers to open the new workroom in that editor. --no-editor and --json turn the offer off.
Variables for the installer
install.sh reads these.
| Variable | Effect |
|---|---|
WORKROOM_INSTALL_PATH |
The folder to install the CLI into. The default is ~/.local/bin. |
VERSION |
Install this release, such as v3.0.0, in place of the latest. It overrides WORKROOM_CHANNEL. |
WORKROOM_CHANNEL |
stable (the default), pre or nightly. nightly installs a separate workroom-nightly binary. |
| WORKROOM_CHANNEL=nightly
See Install and Updates and channels.