Running as a Service
Running as a Service
If you want BabyClaw running in the background and starting automatically when your machine boots, install it as a system service.
Why run as a service
Running BabyClaw as a service means:
- It starts automatically when your machine boots
- It restarts if it crashes
- You don't need to keep a terminal open
- Heartbeats and schedules keep running even when you're not looking
If you just want to try BabyClaw out, running it directly with node packages/gateway/dist/main.js is fine. Set up the service when you're ready to use it day-to-day.
Installing the service
babyclaw service install
On macOS, this creates a launchd plist and loads it. The gateway will start on login.
On Linux, this creates a systemd user service. The gateway will start when you log in.
Linux: enabling lingering
By default, systemd stops user services when you log out. For an always-on assistant (especially on a server), you need to enable lingering:
sudo loginctl enable-linger $USER
This keeps your user services running even when you're not logged in. The install command tries to do this for you, but it may need sudo.
Managing the service
babyclaw service start # start the service
babyclaw service stop # stop the service
babyclaw service restart # restart the service
babyclaw service status # check if it's running
Uninstalling the service
babyclaw service uninstall
This removes the launchd plist (macOS) or systemd unit file (Linux) and stops the service.
Running without a service
If you prefer not to use a system service, you can run the gateway directly:
node packages/gateway/dist/main.js
Or use a process manager like pm2:
pm2 start packages/gateway/dist/main.js --name babyclaw
The gateway runs in the foreground and logs to stdout. Press Ctrl+C to stop it.