openclaw - 💡(How to fix) Fix Bug: launchd plist not updated when upgrading via npm install -g [1 comments, 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#59810Fetched 2026-04-08 02:40:18
View on GitHub
Comments
1
Participants
1
Timeline
4
Reactions
0
Participants
Timeline (top)
closed ×1commented ×1cross-referenced ×1locked ×1

When OpenClaw is upgraded via npm install -g openclaw@<version>, the launchd .plist file is not updated to reflect the new installation path. This causes the gateway service to silently crash on every start after the upgrade.

Error Message

Error: Cannot find module '/opt/homebrew/lib/node_modules/openclaw/dist/index.js' at Module._resolveFilename (node:internal/modules/cjs/loader:1475:15) ... code: 'MODULE_NOT_FOUND'

Root Cause

When OpenClaw is upgraded via npm install -g openclaw@<version>, the launchd .plist file is not updated to reflect the new installation path. This causes the gateway service to silently crash on every start after the upgrade.

Fix Action

Workaround

Manually edit ~/Library/LaunchAgents/ai.openclaw.gateway.plist to update the ProgramArguments path from the old location to the new one, then reload:

# Find correct path
which openclaw  # → /Users/roger/.npm-global/bin/openclaw → resolves to .npm-global/lib/node_modules/openclaw/openclaw.mjs

# Edit plist to replace old path with new path in ProgramArguments
# Then reload:
launchctl unload ~/Library/LaunchAgents/ai.openclaw.gateway.plist
launchctl load ~/Library/LaunchAgents/ai.openclaw.gateway.plist

Code Example

Error: Cannot find module '/opt/homebrew/lib/node_modules/openclaw/dist/index.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1475:15)
    ...
    code: 'MODULE_NOT_FOUND'

---

# Find correct path
which openclaw  # → /Users/roger/.npm-global/bin/openclaw → resolves to .npm-global/lib/node_modules/openclaw/openclaw.mjs

# Edit plist to replace old path with new path in ProgramArguments
# Then reload:
launchctl unload ~/Library/LaunchAgents/ai.openclaw.gateway.plist
launchctl load ~/Library/LaunchAgents/ai.openclaw.gateway.plist
RAW_BUFFERClick to expand / collapse

Summary

When OpenClaw is upgraded via npm install -g openclaw@<version>, the launchd .plist file is not updated to reflect the new installation path. This causes the gateway service to silently crash on every start after the upgrade.

Environment

  • macOS (arm64, Mac mini)
  • Previous install: via Homebrew (/opt/homebrew/lib/node_modules/openclaw/)
  • Upgraded to: 2026.4.1 via npm install -g [email protected] (path: /Users/roger/.npm-global/lib/node_modules/openclaw/)
  • LaunchAgent: ~/Library/LaunchAgents/ai.openclaw.gateway.plist

Steps to Reproduce

  1. Install OpenClaw via Homebrew
  2. Gateway is configured and working — launchd plist created pointing to /opt/homebrew/lib/node_modules/openclaw/dist/index.js
  3. Upgrade to a newer version via npm install -g openclaw@<version>
  4. Gateway service starts crashing silently on every boot

Observed Behaviour

The gateway appears to be running (launchd shows it loaded), but immediately exits. openclaw gateway status reports Runtime: stopped. The error log shows:

Error: Cannot find module '/opt/homebrew/lib/node_modules/openclaw/dist/index.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1475:15)
    ...
    code: 'MODULE_NOT_FOUND'

The plist still contained the old Homebrew path even though OpenClaw had been reinstalled at a different location.

Expected Behaviour

Either:

  • The upgrade process (npm postinstall hook or similar) should detect and rewrite the launchd plist path to match the new installation location, OR
  • openclaw gateway install / openclaw doctor --fix should detect the path mismatch and offer to fix it

Workaround

Manually edit ~/Library/LaunchAgents/ai.openclaw.gateway.plist to update the ProgramArguments path from the old location to the new one, then reload:

# Find correct path
which openclaw  # → /Users/roger/.npm-global/bin/openclaw → resolves to .npm-global/lib/node_modules/openclaw/openclaw.mjs

# Edit plist to replace old path with new path in ProgramArguments
# Then reload:
launchctl unload ~/Library/LaunchAgents/ai.openclaw.gateway.plist
launchctl load ~/Library/LaunchAgents/ai.openclaw.gateway.plist

Impact

High — the gateway stops working silently after every npm-based upgrade. The user has no obvious indication of what is wrong unless they check the stderr log directly.

extent analysis

TL;DR

Manually updating the ProgramArguments path in the ai.openclaw.gateway.plist file to reflect the new installation location after an npm-based upgrade fixes the silent crash of the gateway service.

Guidance

  • After upgrading OpenClaw via npm, verify the installation path using which openclaw to ensure you have the correct new path.
  • Manually edit ~/Library/LaunchAgents/ai.openclaw.gateway.plist to update the ProgramArguments path from the old location to the new one.
  • Reload the launch agent using launchctl unload and launchctl load commands to apply the changes.
  • Consider running openclaw gateway status after the fix to confirm the gateway service is running as expected.

Example

# Find the new path
which openclaw

# Edit the plist file (assuming the new path is /Users/roger/.npm-global/lib/node_modules/openclaw/openclaw.mjs)
# Update ProgramArguments in ~/Library/LaunchAgents/ai.openclaw.gateway.plist

# Reload the launch agent
launchctl unload ~/Library/LaunchAgents/ai.openclaw.gateway.plist
launchctl load ~/Library/LaunchAgents/ai.openclaw.gateway.plist

Notes

This manual fix is necessary due to the upgrade process not automatically updating the launchd plist file. It's essential to verify the new installation path to ensure the correct update of the plist file.

Recommendation

Apply the workaround by manually updating the ai.openclaw.gateway.plist file and reloading the launch agent, as this directly addresses the path mismatch issue causing the gateway service to crash silently after an upgrade.

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…

Still need to ship something?

×6

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

Back to top recommendations

TRENDING