zeroclaw-labs/zeroclaw · error · anyhow::Error
Service management is supported on macOS and Linux only
Error message
Service management is supported on macOS and Linux only
What it means
install() dispatches on the compiled target: macOS (launchd), Linux (init-system aware install_linux), Windows (install_windows via schtasks). Every other platform falls through to this bail. The message text predates Windows support, so in practice it only fires on builds for other Unixes such as FreeBSD, OpenBSD or illumos.
Source
Thrown at crates/zeroclaw-runtime/src/service/mod.rs:722
.unwrap_or(false)
{
return true;
}
run_capture(Command::new("rc-service").args(linux_openrc_action_args(config, "status")))
.map(|out| out.contains("started"))
.unwrap_or(false)
}
pub fn install(config: &Config, init_system: InitSystem) -> Result<()> {
if cfg!(target_os = "macos") {
install_macos(config)
} else if cfg!(target_os = "linux") {
let resolved = init_system.resolve()?;
install_linux(config, resolved)
} else if cfg!(target_os = "windows") {
install_windows(config)
} else {
anyhow::bail!("Service management is supported on macOS and Linux only");
}
}
pub fn start(config: &Config, init_system: InitSystem) -> Result<()> {
if cfg!(target_os = "macos") {
// Ensure the Homebrew var directory exists before launchd tries to use it.
// The plist may reference this path for WorkingDirectory and log files.
let exe = std::env::current_exe().ok();
if let Some(ref exe_path) = exe
&& let Some(var_dir) = homebrew_var_dir_from_exe(exe_path)
{
let _ = fs::create_dir_all(&var_dir);
}
let plist = macos_service_file()?;
run_checked(Command::new("launchctl").arg("load").arg("-w").arg(&plist))?;
run_checked(Command::new("launchctl").arg("start").arg(SERVICE_LABEL))?;
println!("✅ Service started");
Ok(())View on GitHub (pinned to 88bb9c8533)
Solutions
- Run zeroclaw as a plain foreground process under your platform's supervisor (rc.d, runit, s6) instead of 'service install'
- Wrap 'zeroclaw run' in a platform-native service definition maintained outside the binary
- Request or contribute platform support upstream
Defensive patterns
Strategy: validation
Validate before calling
fn service_install_supported() -> bool {
cfg!(any(target_os = "macos", target_os = "linux", target_os = "windows"))
} Prevention
- Gate service commands in wrappers on OS detection before invoking them
- Document supported platforms (macOS, Linux, Windows) in install docs
- Ship a platform-appropriate service file separately on unsupported OSes
When it happens
Trigger: Executing 'zeroclaw service install' on a platform none of the cfg! branches match; the code compiles there but service management is unimplemented.
Common situations: Porting the binary to a BSD; running an unofficial community build on a niche Unix; cross-compiling and smoke-testing service commands on a non-supported target.
Related errors
- Service log viewing is supported on macOS, Linux, and Window
- the OpenRC log writer is only supported on Linux
- the launchd daemon runner is only supported on macOS
- daemon child exited with status {status}
- Linux service {action} only manages the default zeroclaw ser
AI-assisted analysis of zeroclaw-labs/zeroclaw@88bb9c8533 (2026-08-23).
Data as JSON: /api/errors/f8162bdde4a15b35.
Report an issue: GitHub.