Skip to main content
NullClaw supports native service integration on macOS (launchd), Linux (systemd), and Windows (SCM).

Overview

The service manager installs, starts, stops, and monitors the NullClaw gateway as a background daemon. Supported platforms:
  • macOS: launchd (LaunchAgents)
  • Linux: systemd user services
  • Windows: Service Control Manager (sc.exe)

Installation

1

Install service

This creates a service unit file with:
  • Auto-start on boot
  • Auto-restart on failure
  • Logging to ~/.nullclaw/logs/
2

Start service

3

Check status

Commands

Install

Creates the service unit file and enables auto-start. Does not start the service immediately.

Start

Starts the gateway service. Loads the service if not already loaded.

Stop

Stops the running gateway service.

Status

Shows service state and unit file path:

Uninstall

Stops the service, removes the unit file, and disables auto-start.

macOS (launchd)

On macOS, the service is installed as a LaunchAgent.

Unit File Location

Configuration

Manual Management

Linux (systemd)

On Linux, the service is installed as a systemd user service.

Unit File Location

Configuration

Manual Management

systemd user services require a login session. If you log out, the service stops.To keep the service running after logout, enable lingering:

Windows (Service Control Manager)

On Windows, the service is installed using sc.exe.

Service Name

Configuration

Manual Management

Auto-Start Configuration

All platforms enable auto-start by default:
  • macOS: RunAtLoad=true in plist
  • Linux: WantedBy=default.target in unit file
  • Windows: start=auto in service config
The service starts automatically:
  • On system boot
  • On user login (systemd user services)
  • After crash (auto-restart enabled)

Restart Behavior

macOS

launchd automatically restarts the service if it exits.

Linux

systemd restarts the service after 3-second delay if it exits.

Windows

Windows Service Manager does not auto-restart by default. Configure recovery actions:
This restarts the service after 3 seconds on first three failures.

Logging

macOS

Logs are written to:
View logs:

Linux

Logs are captured by journald:
View last 100 lines:

Windows

Check Event Viewer:
Filter by source: nullclaw

Environment Variables

Linux

The systemd unit file loads environment variables from:
Example .env file:
The EnvironmentFile=-... directive (with - prefix) makes the file optional.

macOS/Windows

Set environment variables in the service configuration or use the config file at ~/.nullclaw/config.json.

Troubleshooting

Service won’t start (Linux)

Check if systemd user services are available:
If you see “Failed to connect to bus”, systemd user services are not enabled. This is common in:
  • Docker containers
  • Minimal Linux distributions
  • SSH sessions without lingering
Enable lingering:

Service stops after logout (Linux)

Systemd user services stop when the user session ends. Enable lingering:

Permission denied (Windows)

Service installation requires administrator privileges. Run as administrator:

Cannot find systemctl

If systemctl is not available on Linux, you cannot use systemd user services. Run the gateway manually or use Docker.

Implementation

The service manager is implemented in src/service.zig:
Platform-specific implementations use child process execution to interact with:
  • launchctl (macOS)
  • systemctl (Linux)
  • sc.exe (Windows)
See ~/workspace/source/src/service.zig for full implementation.