docs/book/src/setup/service.md
ZeroClaw ships with first-class service integration for systemd (Linux), launchctl (macOS), and Task Scheduler / Windows Service (Windows). All three are driven by one CLI surface:
zeroclaw service install # register the service
zeroclaw service start # start it
zeroclaw service stop # stop it
zeroclaw service restart # stop + start
zeroclaw service status # running / stopped, last exit code
zeroclaw service uninstall # remove it
The platform-specific backends are implemented in crates/zeroclaw-runtime/src/service/. You don't have to think about them — but knowing what they produce helps when debugging.
zeroclaw service install writes a user-scoped unit at ~/.config/systemd/user/zeroclaw.service.
The unit:
Type=simple with the agent process staying in the foregroundUser= set to the invoking userSupplementaryGroups=gpio spi i2c (enabled if hardware feature is compiled in)Restart=on-failure with a 10-second backoffExecStart=/home/$USER/.cargo/bin/zeroclaw daemonsystemctl --user start zeroclaw
systemctl --user stop zeroclaw
systemctl --user status zeroclaw
systemctl --user enable zeroclaw # start on login
journalctl --user -u zeroclaw -f # follow
journalctl --user -u zeroclaw --since "1h ago"
If you need ZeroClaw to start before user login (headless SBCs, VPSes), run the install command as root:
sudo zeroclaw service install
sudo systemctl enable --now zeroclaw
When invoked with sudo/root, zeroclaw service install creates a system-scope unit at /etc/systemd/system/zeroclaw.service and provisions a dedicated zeroclaw service user.
Detected automatically when /run/openrc exists (Alpine, some Gentoo configs).
zeroclaw service install # writes /etc/init.d/zeroclaw
rc-service zeroclaw start
rc-update add zeroclaw default # start on boot
zeroclaw service install writes ~/Library/LaunchAgents/com.zeroclaw.daemon.plist and loads it.
launchctl list | grep zeroclaw
launchctl unload ~/Library/LaunchAgents/com.zeroclaw.daemon.plist
launchctl load ~/Library/LaunchAgents/com.zeroclaw.daemon.plist
Logs go to ~/Library/Logs/ZeroClaw/zeroclaw.log (stdout) and zeroclaw.err (stderr).
If installed via Homebrew, brew services is the preferred interface:
brew services start zeroclaw
brew services restart zeroclaw
brew services info zeroclaw
Don't mix zeroclaw service CLI commands with brew services — pick one. Both end up writing a plist; having both around confuses launchctl.
zeroclaw service install creates a scheduled task in the current user's session:
zeroclaw daemon hiddenVerify in Task Scheduler GUI (taskschd.msc) under Task Scheduler Library → ZeroClaw.
Logs go to %LOCALAPPDATA%\ZeroClaw\logs\:
type %LOCALAPPDATA%\ZeroClaw\logs\zeroclaw.log
For servers or multi-user Windows installs, run zeroclaw service install from an Administrator prompt:
:: Administrator cmd.exe
zeroclaw service install
Running elevated causes the installer to register a real Windows Service under LocalSystem instead of a user-scoped scheduled task. Control via services.msc or:
sc query ZeroClaw
sc start ZeroClaw
sc stop ZeroClaw
The service reads config from whichever workspace it was installed against. Order:
$ZEROCLAW_CONFIG_DIR/config.toml if set$ZEROCLAW_WORKSPACE/.zeroclaw/config.toml if set$HOMEBREW_PREFIX/var/zeroclaw/.zeroclaw/config.toml if installed via Homebrew~/.zeroclaw/config.toml (Linux/macOS) or %USERPROFILE%\.zeroclaw\config.toml (Windows)If your service seems to ignore config changes, check which path the daemon is reading:
zeroclaw config list
The first few lines of its output show the config file path it resolved against.
The service does not auto-update. That's deliberate — you pick when to take new code. Subscribe to the GitHub release feed or the Discord #releases channel (see Contributing → Communication).