2026 Rent Mac Mini: launchd vs PM2 for 7×24 Long Tasks — Process Guardian Matrix, Plist Keys, PM2 Boot, and Log Rotation
Indie developers and small teams that run seven by twenty four jobs on a rented Mac Mini need a clear answer: should macOS launchd own the process, or should PM2 sit in front of your Node and Python workers?
This article gives a comparison table, a plist field checklist, PM2 boot wiring, rotation notes, and an FAQ. Jump to Home, the Blog, or Help Center when you are ready to connect. Related long-run guides include long-term task SLA FAQ, cron and watchdog, and Ollama keepalive steps.
Pain points before you pick a supervisor
- Session confusion. Anything started only inside an SSH shell stops when the session ends unless launchd or PM2 owns it.
- Restart storms. Aggressive respawn without ThrottleInterval or PM2 backoff can hide the real defect and fill disks with duplicate logs.
- Ops visibility. You need predictable log paths, exit reasons, and a single place to inspect state after a provider maintenance window.
Selection decision matrix
Use this scan-first grid when you compare process guardians for Apple Silicon hosts. It focuses on fit, logging, crash behavior, and steady-state cost.
| Supervisor | Use case fit | Logging | Crash restart | Resource footprint |
|---|---|---|---|---|
| launchd User Agent | One native binary, Swift or Go worker, or a thin wrapper script you fully control on macOS. | StandardOutPath and StandardErrorPath to files you own; integrate with unified logging if needed. | KeepAlive with SuccessfulExit tuned; ThrottleInterval limits tight respawn loops after crashes. | Minimal extra RAM beyond your job; no persistent interpreter parent unless you launch one. |
| PM2 | Several Node services, Python apps, or mixed runtimes with one mental model and shared ecosystem file. | Per-app logs under PM2 home; optional JSON and module-based rotation. | Built-in restart with max restart counters; cluster mode and graceful reload for rolling deploys. | Persistent Node parent plus PM2 daemon overhead; budget roughly tens of megabytes before your apps. |
A common hybrid is PM2 under launchd: launchd guarantees login-level start, while PM2 manages app-level restarts. Pair this pattern with alerts from health checks and webhooks when you expose HTTP ports.
launchd plist key checklist
Place user agents in ~/Library/LaunchAgents, validate with plutil -lint, then load with launchctl bootstrap gui/$UID on modern macOS.
- Label unique string referenced by launchctl.
- ProgramArguments array with absolute paths; avoid brittle PATH assumptions.
- WorkingDirectory so relative assets resolve the same after reboot.
- RunAtLoad true when you expect start at login.
- KeepAlive dictionary with SuccessfulExit false when exits should trigger restart.
- ThrottleInterval integer seconds between restarts; start near ten for noisy jobs.
- StandardOutPath and StandardErrorPath on a volume with quota headroom.
- EnvironmentVariables for tokens instead of baking secrets into the plist when possible.
- Nice or LowPriorityIO when batch work must yield to interactive sessions.
After edits, launchctl bootout the old entry, then bootstrap again so process guardian state matches disk.
PM2 configuration and login boot
Treat PM2 as your app supervisor while macOS still owns session lifecycle. These steps mirror what most Mac Mini renters need after first SSH setup.
- Install Node LTS, then
npm install -g pm2for a global CLI. - Author
ecosystem.config.cjswith name, script, cwd, env, and max_memory_restart guardrails. - Run
pm2 start ecosystem.config.cjsand confirmpm2 statusshows online workers. - Persist the process list with
pm2 saveafter you trust the graph. - Generate launchd glue via
pm2 startup launchd, paste the printed command, reboot once, and verifypm2 resurrectbehavior. - Document ports and health URLs beside credentials you store from Console.
Resources and log rotation
Long jobs on a rented Mac Mini fail quietly when APFS free space shrinks because uncompressed logs grew without a cap.
- Point launchd stdout files into a dedicated
logs/tree and add newsyslog or a weekly truncate script. - Enable PM2 log rotation module or ship logs to remote storage when retention must exceed weeks.
- Watch unified memory pressure when you run both inference and many workers; align max_memory_restart with real unified RAM.
Citeable defaults: start ThrottleInterval at ten seconds for flaky workers. Expect a small PM2 resident set near fifty to ninety megabytes before counting app heaps. Rotate or compress logs before fifteen percent free space warnings trigger.
FAQ
Should I use launchd or PM2 for a Node API?
Either works. Choose launchd when you want the smallest stack and one service. Choose PM2 when you need clusters, reload without downtime, or many named processes in one file.
Does PM2 replace launchd on macOS?
No. PM2 still needs a login context. The supported pattern is PM2 startup launchd so launchd revives PM2 after reboot.
How do I avoid infinite restart loops?
Set ThrottleInterval for launchd and PM2 max_restarts with exponential behavior in your deploy script so operators get a clean failure signal.
Where do I rent hardware after this checklist?
Open Purchase, pick a Mac Mini profile that matches RAM for your workers, then follow Help Center SSH steps.
Next steps. Wire your process guardian, validate reboot behavior once, then move automation to a dedicated node. Review Pricing, complete Purchase, and keep Blog runbooks beside your on-call notes.
Rent a Mac Mini for launchd and PM2 workloads
Need Apple Silicon online for seven by twenty four builds, agents, or batch workers? Start from Home, compare plans on Pricing, then Rent Now. Browse the Blog for long-run hosting guides and use Help Center for SSH access.
A rented Mac Mini keeps your launchd and PM2 configs portable across projects. Finish Purchase, bookmark Help, and explore more long-term task notes on the Blog or return to Home.