AI / Automation April 22, 2026

2026 OpenClaw ulimit, memory, and CPU guardrails on a rented Mac mini under launchd

ProxyMac Engineering Team April 22, 2026 ~12 min read

OpenClaw on a ProxyMac Mac mini M4 in HK, JP, KR, SG, or US dies quietly when resident memory crosses what launchd thought was safe: the UI still shows “running,” but channel adapters stop accepting work because the kernel evicted pages faster than your probe interval. Operators blame “bad models” when the real issue is default ulimit -n 256 on unattended jobs, or fork bombs from MCP children described in MCP setup. This 2026 guide maps silent OOM signatures, contrasts shell vs LaunchAgent ulimits, lists three numeric telemetry thresholds (70% RAM headroom, 10k open files, 2 GB swapins per hour), shows a copy-pastable plist fragment for SoftResourceLimits, and ties limits to parallel agent concurrency plus health probes so you alert before users notice.

Pair with deployment troubleshooting for log triage and help center runbooks; scale hardware via pricing when limits hit architecture, not typos.

Silent OOM and limit signals you should log before blaming models

macOS unified logging often buries jetsam events under info-level noise. Watch for tool latency p95 jumping >4× while CPU stays <40%—that pattern screams memory pressure, not slow LLMs. Another giveaway is ENOTFILE or Too many open files in MCP stdio bridges when concurrent agents spike.

  • Compressor swapins: sustained >500 MB/hour on an 16 GB mini means you are already past comfortable headroom.
  • LaunchAgent throttleReason strings referencing resource-limits—capture the plist version in git.
  • Spurious 502s from local HTTP gateways when the worker child cannot spawn—often RLIMIT_NPROC.

launchd vs interactive shell: two different ulimit worlds

SSH sessions sourced from ~/.zprofile may run ulimit -n 65535; your LaunchAgent does not unless duplicated. Always print limits inside the same wrapper script the plist invokes, not from your laptop shell.

ContextTypical maxfilesWho sets itRisk
SSH login10240+Shell rcMisleading when debugging launchd
LaunchAgent default256–1024OS defaultsMCP bursts exhaust quickly
After plist SoftResourceLimits8192–65535Your ops teamMust match FD hygiene in code

Telemetry thresholds that justify paging someone

Instrument your existing health probe script to append three numbers to syslog every minute: free pages, file descriptor count, and compressor pages. Page on-call when any two consecutive samples cross:

Rule bundle: free RAM under 2.5 GB on a 16 GB SKU, open FDs over 8000, or compressor pages over 120000—adjust proportionally for 24 GB machines.

Plist snippet: SoftResourceLimits without fork-bombing launchd

Add keys under the agent dict—not the global domain. Keep hard limits ≤ soft limits × 1.25 so misconfigurations fail fast instead of wedging.

<key>SoftResourceLimits</key> <dict> <key>NumberOfFiles</key><integer>8192</integer> <key>NumberOfProcesses</key><integer>512</integer> <key>Stack</key><integer>8388608</integer> </dict>

Reload with launchctl kickstart -k gui/$(id -u)/com.example.openclaw only after you have a second SSH session—reuse the discipline from gateway restart recovery.

Each parallel agent in the concurrency guide duplicates model handles and MCP sockets. If doubling concurrency adds 3.2 GB RSS in lab tests, do not also double NumberOfFiles “just in case”—you will mask leaks. Instead, cap concurrency until RSS fits 70% of physical RAM after macOS baseline services.

Secrets note: raising RLIMIT_MEMLOCK rarely helps OpenClaw; keep Keychain-backed secrets per secrets hardening instead of mmap-heavy caches.

FAQ

For 8 GB / 16 GB tier budgeting with Activity Monitor, swap, and local ULM scheduling, see the Mac mini memory & swap guide.

Should I run OpenClaw as root for higher limits? No—fix plist limits; root widens blast radius.

Does Activity Monitor suffice? For spot checks yes, but automated memory_pressure logs catch overnight regressions.

What about Docker sidecars? If you colocate containers, subtract their RSS from the 70% budget first.

Why Apple Silicon Mac mini still fits resource-heavy OpenClaw

M4 unified memory lets model weights and macOS services share bandwidth without PCIe NUMA surprises common on cheap x86 VMs. Renting per region via pricing keeps finance aligned when you need a 24 GB SKU for higher limits, and native launchd integration beats systemd-in-Linux containers pretending to be Mac-friendly. Document plist versions beside Git commits per GitOps, link this guide from onboarding, and recycle the mini when the workload completes—limits are easier when the metal is predictable.

Right-size OpenClaw hardware

HK / JP / KR / SG / US Mac mini for automation with headroom