Running Supaterm in the background

On Linux, macOS, and Windows, Supaterm can run as a service for your user so you do not need to keep a terminal open.

Manage the service

Install the supaterm CLI first (Install Supaterm), then run these commands on the machine that will host Supaterm:

Task Command
Install and start supaterm service install
Inspect status and log location supaterm service status
Move to a newer release supaterm update
Restart supaterm service restart
Stop and remove from startup supaterm service uninstall

Uninstalling the service leaves your projects, threads, and settings intact. Running supaterm service install again repairs a service that supaterm service status reports as broken.

supaterm update downloads the newest release on your channel and switches supaterm and the service to it. Restarting interrupts running agent turns, terminals, and remote clients, so it asks first; answer no and the service keeps running the old version until you run supaterm service restart. Pass --yes from a script. A server you started by hand is left running; stop and start it again to pick up the new version. Wait for any remote update already in progress before updating; to match a remote client’s version, follow Updating Supaterm.

Pass an exact version (supaterm update 0.0.42) to pin one, --channel nightly to switch trains, or --allow-downgrade to move backwards. preview is a maintainers’ test train: its builds can be broken and are never offered as updates, so the installer and supaterm update ask for confirmation before installing one.

supaterm uninstall removes the background service, the supaterm launcher, and the downloaded versions after showing you the list and asking once. Your projects, threads, and settings under ~/.supaterm/userdata are kept, along with service.env under Supaterm home. Pass --yes from a script.

Configure the service environment

Put custom environment variables in service.env under the service’s Supaterm home directory, normally ~/.supaterm/service.env. This file survives service installation and updates. For example:

SUPATERM_PORT=3773
SUPATERM_HOST=127.0.0.1

Use KEY=VALUE entries, quoting values that contain spaces or #. Values are literal: shell commands and variable expansion are not evaluated. Entries override the inherited service environment, except for PATH, SUPATERM_HOME, SUPATERM_BOOT_SERVICE_UNIT, and SUPATERM_SERVICE_LAUNCHER_CONTEXT (including case variants).

Run supaterm service restart after changing the file. Changes apply when the service starts again; switching the server version alone keeps the current values. For a service installed before env-file support, run supaterm service install once with an up-to-date CLI. A missing file is ignored; other read failures stop service startup. If the file contains credentials, restrict access to that file with chmod 600 (for the default Supaterm home, chmod 600 ~/.supaterm/service.env).

Platform support

Linux needs systemd user services. Setup enables lingering so Supaterm starts at boot and keeps running after logout. If this needs administrator permission, setup prints a recovery command before changing the service. Agents and terminals run in their own systemd scopes, so when one runs the machine out of memory only that agent is killed and its turn fails with “Killed: out of memory.” Processes they start, such as dev servers, keep running when the service restarts.

macOS starts the service when you log in and stops it when you log out. Keep the Mac logged in and awake for unattended remote access. Installing over SSH while nobody is logged in at the Mac’s screen can fail at the final start step; the service is still installed and will start at the next login.

Windows starts the service when you log in and stops it when you sign out. It runs without a window as the supaterm-<domain>-<user name> task in Task Scheduler, and Task Scheduler starts it again within a minute if it exits. Lock the screen instead of signing out, and keep the PC awake, for unattended remote access. Installing over SSH while nobody is signed in at the PC can fail at the final start step; the service is still installed and will start at the next sign-in.

Keep the computer awake while agents work

While an agent is working, the machine running Supaterm does not go to sleep when idle, and may sleep again a minute after the work ends. Closing a laptop lid or choosing sleep still puts it to sleep. Turn this off with Keep awake while agents work in Settings > Maintenance.

Keep the server responsive when agents use all memory

On Linux, agents already run with lower priority than the server. When they fill the machine’s memory, though, the kernel may still slow down or stop the server, because only an administrator can reserve memory for it. Run, as your normal user:

supaterm service protect

It shows the system settings it will change, asks before applying them, and then asks for your sudo password. If the machine runs Tailscale or SSH, it also offers to protect them, so you can still reach the machine. Memory protection takes effect at once. The server’s protection from the kernel’s out-of-memory killer takes effect after supaterm service restart. supaterm service status reports whether the protection is in place, and supaterm service protect --undo removes it.

Troubleshooting

Start with supaterm service status on the host. It prints the log path and, on Linux, checks whether the installed service is running, enabled, and allowed to survive logout.

If it stops when your SSH session closes, check for linger-disabled. An administrator can enable lingering with:

sudo loginctl enable-linger "$(id -un)"

Over SSH, allow sudo to prompt:

ssh -t your-server 'sudo loginctl enable-linger "$(id -un)"'

Then retry service setup as your normal user. Run only the loginctl command with sudo; running Supaterm as root creates a separate installation. Without administrator access, run supaterm serve in a terminal and keep that session open.

Status problem Next step
linger-unavailable Run loginctl show-user "$(id -un)" --property=Linger and check that systemd-logind is available.
user-manager-unavailable Run systemctl --user status in a login session for the service user; check your distribution’s systemd user-session support.
service-disabled or service-stopped Read the log and, on Linux, systemctl --user status supaterm.service, then use the repair command printed by Supaterm.
restart-pending A newer version is installed but the service still runs the previous one. Run supaterm service restart.

On macOS, check System Settings → General → Login Items if the service no longer starts at login. If agent work cannot access Desktop, Documents, or Downloads, it may need Full Disk Access for the supaterm executable listed in ProgramArguments in ~/Library/LaunchAgents/com.supaterm.desktop.service.plist.

Delete history older than a day

Supaterm keeps its internal event history and, while it runs, removes only entries that newer ones replace, so the database keeps growing. To stop that, turn on Delete history older than a day in Settings > Maintenance (web, desktop and mobile), or run supaterm doctor --prune-events. Your conversations, diffs and checkpoints are kept.

  • Before it deletes anything the first time, Supaterm copies the database to statev2-before-pruning.sqlite beside it, in the userdata folder of the data directory. If a copy of an earlier database is already there, it is kept and the new copy gets a number, as in statev2-before-pruning-2.sqlite. The copy needs free disk space about the size of the data in use; without it nothing is deleted, and Settings > Maintenance and supaterm doctor say why. Delete the copy once you no longer need it.
  • The first pass only records where history ends. A pass at least a day later removes what came before that point. With the setting on, passes run every six hours. supaterm doctor --prune-events --dry-run shows how many events a pass would remove now, or when it can start.
  • An older Supaterm cannot use a pruned database. It would show incomplete threads to clients that reconnect from before the pruned point. Do not downgrade after pruning. To undo pruning, turn the setting off, stop Supaterm, replace statev2.sqlite with the copy, and delete statev2.sqlite-wal and statev2.sqlite-shm; work done since the copy was taken is lost.
  • The freed space stays inside the database file until it shrinks, on its own or after the repair below.

Reclaim database space

Supaterm removes superseded internal history on its own while it runs; your conversations are kept. Databases created before this shrank automatically still hold the freed space on disk until a one-time offline repair returns it and turns on automatic shrinking. Settings > Maintenance (web and desktop) or Settings > Maintenance (mobile) suggests the repair when at least 1 GiB can be reclaimed.

When the desktop app or the background service runs Supaterm on that machine, select Reclaim in Settings on web or desktop. Supaterm checks for free disk space, then stops, repairs the database, and starts again. It is offline while the repair runs, and running agents stop. If the repair fails, Settings shows why.

In other cases, such as a server you started by hand, run supaterm doctor on the machine that hosts the environment. It reports the database size and the space it can reclaim, then asks which repairs to run; pass --fix to run the recommended ones without a prompt (for scripts), or --dry-run to only report. An installed background service for the same data directory is stopped for the repair and started again afterwards, also when the repair fails. Quit a server you started by hand, or the desktop app, first: the repair refuses to touch a database that is in use, and names the server process that holds it when it can tell. While the repair runs, a server started for the same data directory, for example by a desktop app connecting over SSH, is refused until the repair ends. Use --base-dir for a different data directory.

The repair’s time grows with the size of the whole database, not only the space it reclaims, and can exceed an hour on a large database or a slow disk; supaterm doctor shows each step as it runs. It rebuilds the database through a temporary copy, so it needs free space of about twice the data still in use (the database size minus the reclaimable space): once in the system temporary directory (on Linux and macOS, TMPDIR, or /var/tmp when it is not set) and once next to the database for its write-ahead log.

Edit this page on GitHub