Skip to content

fix(launchd): use kickstart/kill instead of deprecated start/stop on macOS #4820

@stantont

Description

@stantont

Bug Description

hermes gateway start, hermes gateway restart, and hermes gateway stop fail silently on modern macOS because hermes_cli/gateway.py uses deprecated launchctl subcommands.

Symptoms

  • hermes gateway start prints "✓ Service started" but the gateway does not start
  • hermes gateway restart leaves the gateway down after an update
  • Running the commands manually produces: Not privileged to start service

Root Cause

launchctl start <label> and launchctl stop <label> are deprecated on macOS. When a service is already registered in the launchd bootstrap domain (i.e., the plist has been loaded before), launchctl start returns a non-zero exit code with the error Not privileged to start service.

Affected code in hermes_cli/gateway.py:

  • launchd_start() — uses launchctl load + launchctl start
  • launchd_stop() — uses launchctl stop

Fix

Replace with the modern equivalents:

  • launchctl bootstrap gui/<uid> <plist> instead of launchctl load
  • launchctl kickstart gui/<uid>/<label> instead of launchctl start
  • launchctl kill SIGTERM gui/<uid>/<label> instead of launchctl stop

These are the commands recommended by Apple since macOS 10.11 and work correctly whether or not the service is already registered in the bootstrap domain.

Workaround

Until fixed, start the gateway manually:

launchctl kickstart gui/$(id -u)/ai.hermes.gateway

Environment

  • macOS (Apple Silicon)
  • Hermes v0.7.0 (2026.4.3)
  • Service managed as a LaunchAgent under ~/Library/LaunchAgents/ai.hermes.gateway.plist

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions