How to Run Claude Code 24/7 on a Mac Mini: 7 Steps and the Janitor Jobs I Added After It Choked
Chris Alarcon ·
$ you'll have
A computer that stays on, comes back after a power cut, stays in sync with your main laptop and runs your Claude Code jobs while you sleep.
ok your job, with the steps below
- Cost
- A Claude Pro or Max plan, plus a computer you already own
- Tools
- Claude Code · macOS Energy settings · launchd
Why this setup, and what you need
Don’t buy a Mac mini yet. That’s what I’d tell anyone who asks.
“No, you don’t need to buy one.” Use the computer you already have, plugged in, and start there.
I say that with my own Mac mini running 104 background jobs in my house. I named it Iris, which is why its jobs and shortcut below start with “iris”. It’s a 2020 M1 with 8 GB of memory, and my MacBook Pro is still my main machine.
And it has choked on me. “It choked and we burned a lot of usage. I burned 50%.”
So here’s the setup in the order I built it, plus the janitor jobs I added so that night doesn’t happen again. This is what my Mac mini runs, read straight off the machine today:
$ launchctl list | grep -cE 'com\.(chris|shiplean)'
104
| Job on my Mac mini | Runs | What it does |
|---|---|---|
| repo-sync | Every 5 minutes | Pulls my latest files so the mini matches my MacBook |
| iris-guard | Every 15 minutes | Kills jobs that have been stuck for hours |
| tab-janitor | Every 30 minutes | Closes browser tabs my robots (scheduled jobs) left open |
| iris-mem-sweep | 2:30 a.m. | Quits apps that hog the 8 GB of memory |
| log-rotate | 2:30 a.m. | Trims old log files |
| robot-helpdesk | 3:30 a.m. | Sorts last night’s broken jobs and prepares fixes |
| job-health | 7:45 a.m., 12:15 p.m., 8:15 p.m. | Checks which jobs failed |
Schedules read from launchd on my Mac mini, October 23, 2026.
What you need (as of October 23, 2026)
- A computer that can stay plugged in. An old laptop works if the lid stays open. Anthropic’s Desktop scheduled tasks docs say it plainly: “Closing the laptop lid still puts it to sleep.”
- A Claude plan with Claude Code. Pro or Max, per Anthropic’s support page on Claude Code plans. Background jobs count against the same limits as your chats.
- One job worth running while you sleep. No job, no machine. Step 1 is about that.
- A work laptop? Don’t make it your 24/7 box. Apple’s automatic login article notes that a Mac supervised by your organization can be blocked from logging in on its own, so ask IT first.
- Skip for now: buying hardware, and steering it from your phone. The phone part has its own page.
Step 1: Pick the job before you pick the machine
Write down one job that should run while your computer is off.
“But have a use case. Don’t just buy it to buy it.”
I bought the Mac mini for OpenClaw (an always-on AI agent app I ran before) when it first came out. Then Hermes, another agent app, ran on it. Then both got nuked, and I never really found a use case for either after that. On October 6 I retired both.
“Grok Bot became the first agent where it was like, okay, this is different.” Now I’m working with my ChatGPT dot, which OpenAI’s help center calls “an always-on agent in ChatGPT.” It’s always changing, man.
What stuck is the station. When I edit videos, all of that happens on the Mac mini, so it’s an app I can reach 24/7.
If you do buy one, you don’t need the latest. My first guess was a hundred or two hundred on eBay. A search of used listings on October 23 showed asking prices closer to $250 to $325 for an M1 like mine. Those move, so check before you buy.
Fill this in before you spend anything:
Job: [the thing you'd run overnight, e.g. "edit tomorrow's video"]
How often: [every night / every Friday]
What I check in the morning: [the file, report or message it leaves]
Applicable for: anyone who already runs one long Claude Code job and has to babysit the laptop for it.
Step 2: Keep your laptop as home base, and set the other computer to never sleep
System Settings > Energy > Prevent automatic sleeping when the display is off
My main session is still on the MacBook Pro. The mini doesn’t replace it. It’s the machine that’s awake when the MacBook isn’t.
On the always-on computer, turn off sleep. Apple’s sleep guide gives the switch above for desktops. On a laptop it reads “Prevent automatic sleeping on power adapter when the display is off,” under Battery > Options.
Here is what my Mac mini reports:
$ pmset -g (excerpt, October 23, 2026)
autorestart 1
disksleep 0
sleep 0 (sleep prevented by Claude, caffeinate, powerd, mds_stores)
sleep 0 means it never sleeps. That’s the line you want.
Where it breaks: running caffeinate and calling it done. Apple’s manual page says its sleep block lasts “for the duration of the utility’s execution.” Reboot, and it’s gone. The Energy setting stays.
Step 3: Make it start back up after a power cut
System Settings > Energy > Start up when power is connected > Always (Mac mini from 2024 on, macOS 26.5 or later)
Apple’s power-on article says this setting also turns the Mac on “when power is restored after a power failure.” Older models like my M1 show a simpler switch on the same pane, “Start up automatically after a power failure,” per Apple’s Energy settings guide. That’s the autorestart 1 line in step 2.
Then check one more thing, because it decides whether your jobs come back. Apple’s automatic login article says manual login is required when FileVault is turned on.
So with FileVault on, a power cut leaves the Mac at the login screen. Your scheduled jobs start only after someone logs in. Decide which you’d rather have, and know which one you picked.
Step 4: Sync your files to it every five minutes
One sync job, every 300 seconds
This is the step that made it feel like one computer instead of two. “My Mac mini syncs up with my repo, so it’s always up to date, every five minutes.”
My folders live on GitHub, so the sync pulls the latest copy every five minutes. Its rule: if a file on the mini has edits that aren’t saved anywhere else, it refuses to overwrite it and logs the problem instead.
So I step away, the MacBook Pro is off, and I want to do something. The mini’s folders already match. As far as I’m concerned, it’s the same experience.
The one gap: I won’t see the chat I had open on the MacBook Pro. When I’m back on it, I ask the MacBook Pro to pull that chat up and resume there.
Yours doesn’t need GitHub. Whatever sync you already trust works, as long as both machines see the same folder.
Step 5: Make one word open a Claude session on it
One shortcut in your shell settings, then type the word
When I’m logged in on the Mac mini, I just type in “iris” and boom, it opens the Claude session immediately.
That’s the whole trick. If opening a session on the always-on machine takes six steps, you’ll go back to the laptop every time.
Here’s the shape of a shortcut like that, one line in your shell settings file (~/.zshrc on a Mac):
alias iris='cd ~/your-work-folder && claude'
Swap in your own folder and your own word. Open a new Terminal window, type the word, and Claude Code starts in that folder.
Step 6: Move every scheduled job onto the always-on machine
launchd, the Mac’s built-in scheduler, in ~/Library/LaunchAgents/
Everything has moved to the Mac mini. Everything saves there, and all the jobs run there.
Most of my 104 jobs are plain scripts. Only some of them call Claude Code headless, with claude -p (Claude Code’s headless mode: it runs a prompt with no chat window). A few run Codex or Gemini instead.
I use launchd because the in-app schedulers have limits for this:
| Option | What breaks for 24/7 work | Source |
|---|---|---|
/loop in a session | “Recurring tasks automatically expire 7 days after creation.” | Scheduled tasks docs |
| Desktop app scheduled tasks | Run only while the app is open and the computer is awake. “If your computer sleeps through a scheduled time, the run is skipped.” | Desktop scheduled tasks docs |
| launchd job | Survives restarts, runs on a timer or a clock time | Apple’s launchd guide |
One trap on headless jobs. Anthropic’s headless docs say --bare mode “doesn’t use your subscription login” and needs an API key. A job written that way bills the API, not your plan.
The launchd file that keeps Claude Code itself running, and how I steer it from my phone, are in my Claude Code Remote Control setup. I won’t repeat them here.
Step 7: Add the janitors before the night it chokes
Three timers and two nightly jobs, all in launchd
Back to that 50%:
“Today is Friday; by tomorrow morning I would have already been at 50% usage. That’s a big jump from right now: I’m at 15%, using it very lightly.”
The janitors came one scar at a time:
- Tab janitor, every 30 minutes, since October 8. My robots open browser tabs and walk away. About 20 windows were open on the mini when it went in. It closes the tabs they leave sitting idle.
- Memory sweep, 2:30 a.m., since October 16. The Mac mini has 8 GB, and that night swap hit 97% and a job timed out. It quits the apps and leftover processes that hog memory. This morning it took swap from 1,487 MB used to 851 MB.
- Guard, every 15 minutes, since October 20. That day, test runs hung for hours. It kills test runs older than 2 hours and video renders older than 3, and it never touches Claude or Codex.
Two quieter ones run beside them: log cleanup at 2:30 a.m., and a health check three times a day that flags failed jobs.
How to tell they work: they’re boring. The guard has logged nothing but heartbeats since October 20. The tab janitor closed one or two tabs a handful of times last week.
Even now I’m a little inefficient. “We have an issue with our editing skill that I was tweaking last week and now we’re paying for it.” Janitors don’t fix a bad skill. They keep the mini from choking.
Check it worked: wake up to a review, not a mess
Every morning: read what ran overnight, then approve or skip
One of the overnight jobs fixes easy bugs. When one of my jobs breaks, the robot help desk picks it up at 3:30 a.m. Gemini classifies it, like IT support: what’s in the backlog, what’s pending?
“This is easy, hand it off to Codex. This is hard, hand it off to Claude.”
Codex prepares and tests the easy fixes. Claude Opus diagnoses the hard ones. Nothing ships on its own.
Then every morning I review them. My dot, the ChatGPT agent, messages me: this got fixed, do you want to fix it this way? I tap yes or I don’t. How I split work between the two tools in the daytime is in using Codex and Claude Code together.
It’s new. I built it on October 22, and last night’s run finished with nothing in the queue. That’s a good night.
Roby at Coding with Roby runs the same shape on his Mac mini: “It does work for me while I sleep, and I wake up to a queue of pull requests waiting for review.” Same rule. The machine works, a human ships.
Last check is the meter. Anthropic’s Claude Code plan page says the five-hour and weekly limits “are shared across Claude and Claude Code.”
My Claude usage meters, Max plan, September 5, 2026.
Every overnight Claude job draws from that same bar. If it jumped while you slept, open the logs before you open a new chat. How those meters reset is in Claude usage limits explained.
Have a use case, then let it run
You don’t need a new box to start. You need one job worth doing while you sleep, and a computer that stays awake for it.
Mine went from OpenClaw to Hermes to Grok Bot to my dot. It’s always changing. The setup underneath didn’t: never sleep, stay in sync, one word to open it, and janitors so it doesn’t choke.
My rule: have a use case. Don’t just buy it to buy it.
So tonight, plug in the laptop you already have, turn off sleep, and give it one job. Every other Claude guide for work, in order, lives on Claude guides.
FAQ
Do I need a Mac mini to run Claude Code 24/7?
No. Any computer that can stay plugged in and awake works, including an old laptop with the lid open. Buy a Mac mini only once you have a job that needs to run while your main computer is off.
Does caffeinate keep Claude Code running all night?
Only while caffeinate itself keeps running. Apple’s manual says its sleep block lasts for the duration of the command it wraps, so it does nothing after a reboot or a power cut. For a machine that should always be on, use System Settings > Energy instead.
Will my Mac turn back on after a power outage?
Only if you set it to. On a Mac mini from 2024 or later on macOS 26.5 or later, choose Energy > Start up when power is connected. Older Mac minis have Start up automatically after a power failure. If FileVault is on, the Mac then waits at the login screen, and your jobs don’t start until someone logs in.
Do Claude Code /loop tasks run forever?
No. Anthropic’s docs say recurring tasks expire 7 days after creation, firing one last time before they delete themselves. For anything longer, use the Desktop app’s scheduled tasks or the Mac’s own scheduler, launchd.
Does running Claude Code all night use up my plan?
Yes, it draws from the same pool as your daytime chats. Anthropic’s support page says the five-hour and weekly limits on Pro and Max are shared across Claude and Claude Code, so a stuck overnight job can eat the week you planned to use.
Where this comes from
The Energy settings, login rule and scheduler limits come from Apple’s and Anthropic’s docs, read October 23, 2026. The job list, schedules and power readout come off my Mac mini that same day.
The buy advice, the 50% night and the help desk are mine. I haven’t timed a power cut on my Mac mini, and the help desk only went live on October 22.
Published October 23, 2026. Checked that day against Apple’s and Anthropic’s docs, linked inline.
Written by
Chris AlarconChris Alarcon shows people who don’t code the boring Claude setup that actually works. He runs his one-person operation on these systems and shares every workflow, prompt, and tool combo in public. Start with the free 1-page setup.
The boring setup
It still won't know you tomorrow.
The Setup is one folder. Drop it into a Project, answer three questions, and Claude or ChatGPT writes your memory file and your voice file itself. It stops forgetting you, stops sounding like AI, and runs three real jobs by name. Twenty minutes tonight. No code. $39, 30-day refund.
See The Setup →Get the free 1-page setup
The boring 1-page setup. No code, no jargon. Get it now, then one short email from me each Tuesday.