{"slug": "launchd-vs-docker-for-always-on-claude-code-bots-on-a-mac", "title": "launchd vs Docker for Always-On Claude Code Bots on a Mac", "summary": "A Mac-based operator runs 17 Claude Code bots as a single Python process under launchd, deliberately avoiding Docker and cloud hosting, and reported the setup has run every night for a year. The operator cited four traps — launchd not inheriting the shell PATH, the Mac sleeping, log flooding from an intermittently failing DNS resolver, and expiring Claude Code CLI logins — and documented a migration from a laptop to a shared office Mac in October using four scripts in a deploy/ folder, with the rule that the old machine must be taken down first to prevent duplicate polling of the same chat API.", "body_md": "[Claude Code in business](https://botsinproduction.com/blog#claude-code)\n\n# launchd vs Docker for Always-On Claude Code Bots on a Mac\n\nSeventeen bots run as one Python process under launchd on a Mac. No Docker, no cloud. Why, the four traps we hit, and the checklist for moving machines.\n\nWhen people hear “17 bots in production” they picture containers, a cloud box, possibly a small Kubernetes cluster humming in a data centre. Ours is one Python process on a Mac, kept alive by `launchd`, in a folder called `bots`. I have been asked, gently, whether that counts as production. It has run every night for a year, so I’ve decided it does. This post is why, what went wrong, and the checklist we used to move the whole thing to a new machine in an afternoon.\n\n## Why not Docker\n\nThe bots call the Claude Code CLI, which is logged in to a subscription on the machine. That login lives in the user’s keychain and config. Putting the CLI in a container means either baking credentials into an image (no) or mounting the user’s home directory into the container (also no, and at that point the container is isolating you from nothing except your own understanding of what’s running).\n\nDocker also adds a layer the rest of my team can’t see into. If a bot stops, I want “is the process running?” to be answerable by anyone who can open Activity Monitor and squint.\n\nSo: one process, `launchd`, a plain folder. It’s not impressive. It’s visible.\n\n## The shape\n\n- `app.py` starts every bot in one process. One, not seventeen, because they share the Slack connection, the config and the log, and because seventeen processes is seventeen things to forget.\n- A `launchd` plist with`KeepAlive` set, so if the process dies it comes straight back, slightly embarrassed.\n- Logs go to one file that the process itself rotates by copy-and-truncate, because `launchd` holds the file handle and will happily keep writing to a file you’ve renamed.\n- A single config file tells every bot which machine it’s on.\n\nThis is the other half of “always-on on a Mac”: the Mac stays at the office, plugged in, lid closed, and I talk to it from the living-room floor. Not a glamorous ops centre. It doesn’t need to be.\n\n## The four traps\n\n**1. `launchd` doesn’t have your `PATH`.** A bot that worked from the terminal failed as a service because it couldn’t find `claude`. Every external command is now called by full path, and the plist sets `PATH` explicitly. Never, ever call the bare name from code. Tattoo it somewhere.\n\n**2. The machine must not sleep.** Obvious, and still the cause of a week of missing reports. Sleep is off on power. When a bot goes quiet, the first thing I check is the power log, not the bot, because the bot is usually fine and the Mac is usually napping.\n\n**3. Log flooding hides real errors.** A DNS resolver that failed intermittently produced a stack trace on every poll until 90% of the log was one error. Now resolver failures back off and log one line, and the real errors get to be seen.\n\n**4. Token renewal is a job, not a memory.** The CLI’s login expires. A renewal script runs on a schedule and alerts if it fails, because “every bot stopped at the same moment” is exactly what an expired login looks like and exactly the kind of thing I’d otherwise discover on a Monday.\n\n## The migration checklist\n\nIn October we moved from a laptop to a shared office Mac. The kit is [four scripts in a `deploy/` folder](https://botsinproduction.com/blog/migrating-bots-to-a-new-mac-checklist-and-the-wrong-mac/) and one rule in capital letters: **TAKE THE OLD MACHINE DOWN FIRST.** Two copies of the bots polling the same chat API and writing the same sheet is not “redundancy”. It’s a fight.\n\n1. Stop the old process and unload its plist.\n2. Copy the repo folder, plus the two things that are *not* in git: the state files (which chats are done, which photos were shown) and the raw data folder. Forget those and the bot cheerfully re-processes a month of chats on its first run.\n3. Install dependencies on the new machine. Two were missing from our written list and only revealed themselves when a bot tried to resize an image and discovered it couldn’t.\n4. Write the machine’s identity into the config file.\n5. Log the CLI in, as the user the service runs as, not as you.\n6. Load the plist, tail the log for ten minutes, send one test command through Slack, exhale.\n\nThe move took an afternoon. The afternoon before, spent writing the checklist, is what made it an afternoon instead of a weekend.\n\n## When Docker would be right\n\nIf the bots called an API with a key instead of a logged-in CLI, or if more than one person deployed them, a container would earn its keep. For one operator, one machine and a subscription login, it’s a layer that only hides things, and I have enough of those.\n\n## One line from me\n\nOne process, one Mac, full paths everywhere. Not glamorous, and that’s the point.\n\nHow the bot watching that process reads its failures is in [the error watcher post](https://botsinproduction.com/blog/slack-error-watcher-that-diagnoses-itself/).", "url": "https://wpnews.pro/news/launchd-vs-docker-for-always-on-claude-code-bots-on-a-mac", "canonical_source": "https://botsinproduction.com/blog/launchd-vs-docker-for-always-on-bots-on-a-mac/", "published_at": "2026-10-21 00:00:00+00:00", "updated_at": "2026-11-04 02:51:15.354329+00:00", "lang": "en", "topics": ["ai-agents", "ai-tools", "developer-tools"], "entities": ["Claude Code", "launchd", "Docker", "Python", "Slack"], "also_reported_by": [], "takeaway": "Running 17 Claude Code bots as one launchd-managed Python process requires calling external commands like claude by full path with PATH set explicitly in the plist, disabling sleep on power, backing off and logging a single line for intermittent DNS resolver failures, and scheduling CLI token renewa", "recommendation": null, "alternates": {"html": "https://wpnews.pro/news/launchd-vs-docker-for-always-on-claude-code-bots-on-a-mac", "markdown": "https://wpnews.pro/news/launchd-vs-docker-for-always-on-claude-code-bots-on-a-mac.md", "text": "https://wpnews.pro/news/launchd-vs-docker-for-always-on-claude-code-bots-on-a-mac.txt", "jsonld": "https://wpnews.pro/news/launchd-vs-docker-for-always-on-claude-code-bots-on-a-mac.jsonld"}}