openclaw - ✅(Solved) Fix [Bug] bug: `gateway stop` unloads launchd service, requiring `install` before next `start` on macOS [1 pull requests, 1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#43637Fetched 2026-04-08 00:16:28
View on GitHub
Comments
0
Participants
1
Timeline
11
Reactions
0
Author
Participants
Timeline (top)
referenced ×6cross-referenced ×3labeled ×2

openclaw gateway stop calls launchctl bootout which unloads the LaunchAgent, causing gateway start to fail until gateway install is re-run.

Root Cause

openclaw gateway stop calls launchctl bootout which unloads the LaunchAgent, causing gateway start to fail until gateway install is re-run.

Fix Action

Fixed

PR fix notes

PR #43660: fix(launchd): stop should keep service registered for subsequent start

Description (problem / solution / changelog)

Summary

  • openclaw gateway stop now uses launchctl kill SIGTERM instead of launchctl bootout
  • This stops the running process while keeping the service registered in launchd
  • Allows gateway start to work without needing to re-run gateway install

Root Cause

The stopLaunchAgent function was using launchctl bootout which completely unloads the LaunchAgent service from launchd's registry. This caused subsequent gateway start commands to fail with "Service unit not found" until gateway install was re-run.

Fix

Changed stopLaunchAgent to use launchctl kill SIGTERM instead:

  • bootout: Completely removes service from launchd registry ❌
  • kill SIGTERM: Only stops the running process, keeps service registered ✅

This matches the expected behavior:

  • stop: Stop the process
  • uninstall: Remove the service
  • start: Start the process (should work after stop)

Change Type

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Security hardening
  • Chore/infra

Scope

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #43637

User-visible / Behavior Changes

Users can now run gateway stop followed by gateway start without needing to re-run gateway install on macOS.

Security Impact

  • New permissions/capabilities? No
  • Secrets/tokens handling changed? No
  • New/changed network calls? No
  • Command/tool execution surface changed? No
  • Data access scope changed? No

Repro + Verification

Environment

  • OS: macOS (Apple Silicon or Intel)
  • Runtime: Node.js 22
  • Install: npm global

Steps

  1. openclaw gateway install
  2. openclaw gateway start
  3. openclaw gateway stop
  4. openclaw gateway start ← Should work now (previously failed)

Evidence

  • Failing test/log before + passing after (test added)
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers

Human Verification

  • Verified scenarios: macOS LaunchAgent stop/start cycle
  • Edge cases checked: Service already stopped
  • What did not verify: Actual macOS testing (logic verified via code review)

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? Yes
  • Config/env changes? No
  • Migration needed? No

Failure Recovery

  • How to disable/revert this change quickly: Revert this commit
  • Files/config to restore: None
  • Known bad symptoms reviewers should watch for: None expected

Risks and Mitigations

None. This is a targeted fix that corrects the stop behavior to match user expectations.

🤖 Generated by AI Contributor (kincoy)

Changed files

  • src/daemon/launchd.test.ts (modified, +6/-2)
  • src/daemon/launchd.ts (modified, +26/-4)
RAW_BUFFERClick to expand / collapse

Bug type

Regression (worked before, now fails)

Summary

openclaw gateway stop calls launchctl bootout which unloads the LaunchAgent, causing gateway start to fail until gateway install is re-run.

Steps to reproduce

  1. openclaw gateway install
  2. openclaw gateway start
  3. openclaw gateway stop
  4. openclaw gateway start ← fails here

Expected behavior

gateway stop should only stop the running process. gateway start should work again without needing gateway install.

Actual behavior

After gateway stop, running gateway start fails with: "Service unit not found. Service not installed. Run: openclaw gateway install" Even though ~/Library/LaunchAgents/ai.openclaw.gateway.plist still exists. The stop command runs launchctl bootout gui/501/ai.openclaw.gateway which removes the service from launchd's registry entirely.

OpenClaw version

2026.3.8 (3caab92)

Operating system

macOS (Apple Silicon)

Install method

npm global

Model

N/A - not relevant to this bug

Provider / routing chain

$ ls ~/Library/LaunchAgents/ | grep openclaw ai.openclaw.gateway.plist $ openclaw gateway stop Stopped LaunchAgent: gui/501/ai.openclaw.gateway $ ls ~/Library/LaunchAgents/ | grep openclaw ai.openclaw.gateway.plist ← plist still exists! $ openclaw gateway start RPC probe: failed gateway closed (1006 abnormal closure): no close reason Service unit not found. Service not installed. Run: openclaw gateway install

Config file / key location

No response

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

extent analysis

Fix Plan

To resolve the issue, we need to modify the openclaw gateway stop command to only stop the running process without unloading the LaunchAgent.

  • Modify the stop command to use launchctl stop instead of launchctl bootout.
  • Update the stop command to handle the service name correctly.

Example code changes:

# Before
launchctl bootout gui/501/ai.openclaw.gateway

# After
launchctl stop gui/501/ai.openclaw.gateway

Alternatively, if you are using a scripting language like Python or JavaScript, you can use the corresponding library to interact with launchctl.

Verification

To verify the fix, follow these steps:

  1. Run openclaw gateway install.
  2. Run openclaw gateway start.
  3. Run openclaw gateway stop.
  4. Run openclaw gateway start again.

If the fix is successful, the last start command should work without requiring gateway install to be re-run.

Extra Tips

  • Make sure to test the fix on different environments and macOS versions to ensure compatibility.
  • Consider adding error handling to the stop command to handle cases where the service is not running or cannot be stopped.
  • Review the launchctl documentation to ensure the correct usage of the stop command.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

FAQ

Expected behavior

gateway stop should only stop the running process. gateway start should work again without needing gateway install.

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING