openclaw - 💡(How to fix) Fix macOS host integration: `launchd` plugin for installing/managing LaunchAgents from agent code [1 comments, 2 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#74758Fetched 2026-05-01 05:41:41
View on GitHub
Comments
1
Participants
2
Timeline
3
Reactions
2
Author
Timeline (top)
closed ×1commented ×1cross-referenced ×1

Add a small host-integration plugin (or extension) that lets agents install/load/unload macOS launchd LaunchAgents on the host running OpenClaw.

Root Cause

Add a small host-integration plugin (or extension) that lets agents install/load/unload macOS launchd LaunchAgents on the host running OpenClaw.

Code Example

launchd.install({ label, plist, runAtLoad?, startInterval?, calendarInterval? })
launchd.uninstall({ label })
launchd.list({ filter? })          // wraps `launchctl list | grep`
launchd.kickstart({ label })       // for one-off runs
launchd.logs({ label, lines? })    // tails StandardOut/ErrorPath if present
RAW_BUFFERClick to expand / collapse

Summary

Add a small host-integration plugin (or extension) that lets agents install/load/unload macOS launchd LaunchAgents on the host running OpenClaw.

Why

Long-running side projects on this Mac mini (e.g. a flight-price watcher, a heartbeat job) want to drop a ~/Library/LaunchAgents/com.user.foo.plist and launchctl bootstrap/load it. Today the agent has to:

  1. Write the plist to disk (fine, plain Write tool).
  2. Ask the user to open Terminal and run launchctl load -w ~/Library/LaunchAgents/com.user.foo.plist.

Step 2 makes a 5-second task into a 5-minute one. Worse, when something later wants to disable a job, the user has to remember the label and unload it manually.

Proposed surface

launchd.install({ label, plist, runAtLoad?, startInterval?, calendarInterval? })
launchd.uninstall({ label })
launchd.list({ filter? })          // wraps `launchctl list | grep`
launchd.kickstart({ label })       // for one-off runs
launchd.logs({ label, lines? })    // tails StandardOut/ErrorPath if present

label is the plist's reverse-DNS name. The plugin owns the file (writes to ~/Library/LaunchAgents/<label>.plist, runs launchctl bootstrap gui/$UID / bootout).

Scope

  • macOS only (gate on process.platform === "darwin")
  • User-domain agents only at first; system daemons need root and can wait
  • No GUI/agent-of-agents stuff — just a thin wrapper over launchctl

Related

Filed alongside #74757 — both came up while building flight-watch on this host.

extent analysis

TL;DR

Implement a host-integration plugin for OpenClaw to manage macOS launchd LaunchAgents, providing functions for installation, uninstallation, listing, and logging.

Guidance

  • Create a new plugin for OpenClaw that interacts with launchctl to manage LaunchAgents, using the proposed surface API (launchd.install, launchd.uninstall, etc.)
  • Ensure the plugin checks the platform (process.platform === "darwin") to gate functionality for macOS only
  • Implement the launchd.install function to write the plist file to ~/Library/LaunchAgents/ and load it using launchctl
  • Consider adding error handling and validation for the label and plist parameters to prevent potential issues

Example

const fs = require('fs');
const childProcess = require('child_process');

launchd.install = ({ label, plist }) => {
  const plistPath = `~/Library/LaunchAgents/${label}.plist`;
  fs.writeFileSync(plistPath, plist);
  childProcess.execSync(`launchctl bootstrap gui/$UID ${plistPath}`);
};

Notes

This implementation assumes a basic understanding of Node.js and the launchctl command. The example code snippet is a simplified illustration and may require additional error handling and validation.

Recommendation

Apply workaround by implementing the proposed plugin, as it provides a clear and functional solution to the problem.

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