OpenClaw Scheduled Jobs & Unattended Runs on a Cloud Mac mini (LaunchAgent Playbook, 2026)
Interactive demos are easy—production automation means OpenClaw wakes up on Tuesday at 03:15 while your laptop is closed. On a rented Mac mini that job belongs to launchd, usually via a LaunchAgent plist running under the same macOS user that owns your OpenClaw state. Before you trust a plist, finish the macOS TCC, Accessibility & Screen Recording checklist in a real GUI session—otherwise headless jobs will “succeed” while doing nothing. This 2026 playbook compares cron versus LaunchAgent, shows the environment parity traps that break HTTPS proxies, and gives logging plus recovery steps aligned with install & deploy, production workflows, and troubleshooting & recovery. Security baselines remain in OpenClaw security & secrets.
TL;DR
- Use LaunchAgents in
~/Library/LaunchAgentsfor user-scoped OpenClaw jobs; avoid root cron unless you fully understand permission mapping. - Mirror
HTTPS_PROXY,NO_PROXY, and API-related env vars into the plistEnvironmentVariablesdict—not only in~/.zshrc. - Send stdout/stderr to rotated files; alert on non-zero exit codes.
- After editing plists:
launchctl bootout gui/$(id -u)thenbootstrapto avoid duplicate daemons.
LaunchAgent vs Cron (Decision Table)
| Option | Best when | Risk |
|---|---|---|
| LaunchAgent | Per-user OpenClaw CLI with Keychain secrets | Mis-typed plist keys silently fail |
| LaunchDaemon | System-wide tooling shared by multiple users | Harder TCC story; avoid unless required |
| cron | Calling a wrapper script that execs as the right user | No GUI session—Keychain prompts may stall |
Recommended Plist Pattern
Keep arguments minimal: point ProgramArguments at the OpenClaw binary or your shell wrapper, and pass config paths explicitly. Use StartCalendarInterval for clock schedules or StartInterval for periodic polling. Pair with ThrottleInterval if vendor APIs rate-limit bursts.
Environment Parity Checklist
- Copy interactive
printenvoutput into a scratch file. - Diff against what the LaunchAgent sees via a temporary job that runs
env > /tmp/openclaw-agent.env. - Align
PATHto include Homebrew if you rely on/opt/homebrew/bin. - Confirm
OPENCLAW_STATE_DIRpoints to local SSD—not a cloud-synced Desktop folder.
Logging & Rotation
Use StandardOutPath and StandardErrorPath targeting a directory your user owns, e.g. ~/Library/Logs/OpenClaw/. Rotate weekly or when files exceed ~100MB. For regulated teams, forward ERROR lines to your SIEM but strip model prompts. Cross-link noisy failures with deployment recovery before opening vendor tickets.
Failure Matrix
| Symptom | Likely cause | Fix |
|---|---|---|
| Job never starts | Invalid plist XML or wrong label | plutil -lint + launchctl print gui/$(id -u) |
| 401 from LLM API | Keychain unlock missing in headless mode | Pre-authorize keys via one VNC session per VNC guide |
| Duplicate executions | Two plists with overlapping labels | Delete stale plist, bootout, bootstrap once |
Five-Step Recovery Runbook
- Capture last 200 lines of stdout/stderr.
- Verify network egress per proxy / WireGuard article.
- Compare env diff between interactive shell and plist.
- Restart job via
launchctl kickstart -k gui/$(id -u)/label.here. - Document root cause in help ticket with timestamps for support.
Frequently Asked Questions
Should I ever use cron?
Only when a minimal wrapper elevates into the correct user context. LaunchAgent remains the macOS-native default for GUI-adjacent permissions.
Why did HTTPS_PROXY vanish?
LaunchAgents do not source shell profiles—duplicate variables in the plist or a shared config file on disk.
Where should logs live?
Use plist stdout/stderr paths under your home directory, rotate aggressively, and never log secrets.
Why ProxyMac Mac mini for Always-On OpenClaw
Laptops sleep; data centers do not. A dedicated HK / JP / KR / SG / US mini keeps LaunchAgents alive with stable power and cooling, while you keep human access via SSH per SSH vs VNC. Scale capacity from the pricing page when batch windows overlap.
Always-On Mac mini for OpenClaw
LaunchAgents, logs, and API keys that survive logout