Which variables does microManager set?
| Variable | Conductor-compatible name | Value | Example |
|---|---|---|---|
MICROMANAGER | None | Always 1, so a script can tell it is running inside microManager. | 1 |
MICROMANAGER_WORKSPACE_NAME | CONDUCTOR_WORKSPACE_NAME | The workspace’s folder name, a city such as lisbon. It stays the same when you rename the workspace or its branch. CONDUCTOR_WORKSPACE_NAME: The workspace’s name the way Conductor gave it to scripts: lowercase, spaces as hyphens, other punctuation left out. It changes when you rename the workspace, as in Conductor. | lisbon, fix-login-bug |
MICROMANAGER_WORKSPACE_ID | CONDUCTOR_WORKSPACE_ID | The workspace’s unique id. | 8f14e45f-ceea-467f-a0e7-4f3b7d9c1a2b |
MICROMANAGER_WORKSPACE_PATH | CONDUCTOR_WORKSPACE_PATH | Absolute path of the workspace’s git worktree. | ~/micromanager/workspaces/my-app/lisbon |
MICROMANAGER_ROOT_PATH | CONDUCTOR_ROOT_PATH | Absolute path of the repository’s main checkout, where files to copy come from. | ~/code/my-app |
MICROMANAGER_DEFAULT_BRANCH | CONDUCTOR_DEFAULT_BRANCH | The repository’s default branch. CONDUCTOR_DEFAULT_BRANCH: The branch the workspace merges into (its target branch), as in Conductor. | main, release/2.0 |
MICROMANAGER_PORT | CONDUCTOR_PORT | The first of ten ports reserved for this workspace (PORT to PORT+9). Each workspace gets the lowest free multiple of 10 from 51000 up. | 51000 |
MICROMANAGER_IS_LOCAL | CONDUCTOR_IS_LOCAL | Always 1: workspaces run on your own computer. | 1 |
Who gets these variables?
The setup, run and archive scripts, every terminal you open in the workspace, and every agent session. They are
added to the environment of your login shell, so everything else on your PATH is there too.
Can a repository add variables of its own?
Yes, in an [environment_variables] table of its settings files, as in Conductor; a file’s
[environment_variables.local] table, for local workspaces (every microManager workspace is one), wins
over its shared table. They reach the same scripts, terminals and agents, and never replace the variables above.
Scripts has an example.
How do the Conductor-compatible names work?
With Conductor-compatible environment on in Settings → General (it is on by default), each
variable in the second column is set too, with the meaning it had in Conductor. Most hold the same value as their
MICROMANAGER_* twin. Two differ: CONDUCTOR_WORKSPACE_NAME is built from the workspace’s
name, as Conductor built it, so a Docker Compose project or database a Conductor script named after it keeps its
name in an imported workspace; and CONDUCTOR_DEFAULT_BRANCH is the workspace’s target branch. Use
MICROMANAGER_WORKSPACE_NAME for a name that never changes.
Imported workspaces get a new block of ports, so CONDUCTOR_PORT differs from the one Conductor gave
them. Conductor’s cloud and API variables, such as CONDUCTOR_API_KEY and
CONDUCTOR_SESSION_ID, are not set: microManager has no cloud or Conductor API. Turn the setting off if
you have finished moving your scripts to the new names.
How are ports reserved?
Each active workspace gets a block of ten ports. MICROMANAGER_PORT is the first, a multiple of 10
from 51000 up that no other active workspace holds, so $MICROMANAGER_PORT to
$((MICROMANAGER_PORT + 9)) are yours. Archiving a workspace frees its block for the next one.
# Start each workspace's dev server on its own port
pnpm dev --port "$MICROMANAGER_PORT"
# A second service on the next reserved port
pnpm storybook --port "$((MICROMANAGER_PORT + 1))"
# Copy something from the main checkout that files-to-copy does not cover
cp -R "$MICROMANAGER_ROOT_PATH/fixtures/large" ./fixtures/large How can a script tell it is running in microManager?
if [ "${MICROMANAGER:-}" = 1 ]; then
echo "running in microManager workspace $MICROMANAGER_WORKSPACE_NAME"
fi