How to Keep Your MacBook Running 24/7 for AI Agents (Even With the Lid Closed)

If you’re deploying AI agents that need to run continuously, your MacBook can serve as an always-on workhorse—no dedicated server required. The trick is preventing macOS from sleeping even when the lid is closed.

This isn’t a gimmick; it’s how you run the – let agents do the grinding while you do strategy. You go to bed, and they keep working. You close the lid, toss the laptop in your backpack, and they keep working (as long as you manage heat and power).

Why This Matters for Agent Productivity

Imagine having multiple agents browsing, researching, and executing tasks while you sleep. When you wake up, your day starts with completed work, not a cold start.

This is the same principle we use across BlitzMetrics: build systems that run without you staring at the screen.

Terminal Commands to Disable Sleep

These commands require administrator privileges (macOS will prompt you for your password after you run the first command).

1) Prevent sleep entirely (including lid closed)

sudo pmset -a disablesleep 1

The -a flag applies to battery and power adapter.

2) Disable display and disk sleep (extra insurance)

sudo pmset -a sleep 0
sudo pmset -a displaysleep 0
sudo pmset -a disksleep 0

3) Verify your settings

pmset -g

You should see disablesleep 1, sleep 0, and displaysleep 0 in the output.

To undo it later

sudo pmset -a disablesleep 0

A More Targeted Option: caffeinate

pmset is a nuclear switch (your laptop won’t sleep). If you want a more temporary safety net for a single agent run, use:

caffeinate -dimsu

That tells macOS to keep the system awake while the command runs. Useful when you don’t want 24/7 “always awake” behavior.

Practical Warnings (Don’t Skip These)

Keep it plugged in

Running 24/7 on battery will drain it fast, and the system may force-shutdown.

Watch heat like a hawk

A closed lid builds heat. Put the Mac on a hard surface with airflow (ideally a stand). No couch cushions. No stack of mail. No “I’ll just set it on my comforter.”

Disable auto-updates for uptime

System Settings → General → Software Update → Automatic Updates: turn off “Install macOS updates” so macOS doesn’t reboot your agents without warning. Update manually on a schedule.

Crashes won’t auto-recover

If Chrome or another app crashes, it won’t automatically restart. For resilience, you’d use a launch agent or supervision script—that’s a separate project.

Bonus: Control Your Agents Remotely with Claude Dispatch

Anthropic recently rolled out Claude Dispatch (inside Claude Cowork): you pair your phone by scanning a QR code in the desktop app, and you get a persistent conversation thread across devices.

Your phone becomes the remote control. Your Mac does the heavy lifting.

The gotchas: the Mac must be awake and Claude must be running—which is exactly what your sleep-prevention setup solves.

Dispatch is available as a research preview, with access currently rolling out to Pro and Max plans.

Related BlitzMetrics Links

  • The SEO Tree framework: https://blitzmetrics.com/seo-tree/
  • How we build definitive articles (same method used to write this): https://blitzmetrics.com/definitive-article-guide/
  • AI SEO audit case study: https://blitzmetrics.com/ai-seo-audit-nic-padilla-personal-brand-site/

The Big Picture

Combine always-on sleep prevention with Claude Dispatch, and you’ve got a portable AI command center. Your laptop runs agents while you sleep, and you can check in or assign new tasks from your phone while you’re out.

No dedicated home server needed—just your MacBook, a power cable, and good airflow.

Dennis Yu
Dennis Yu
Dennis Yu is the CEO of Local Service Spotlight, a platform that amplifies the reputations of contractors and local service businesses using the Content Factory process. He is a former search engine engineer who has spent a billion dollars on Google and Facebook ads for Nike, Quiznos, Ashley Furniture, Red Bull, State Farm, and other brands. Dennis has achieved 25% of his goal of creating a million digital marketing jobs by partnering with universities, professional organizations, and agencies. Through Local Service Spotlight, he teaches the Dollar a Day strategy and Content Factory training to help local service businesses enhance their existing local reputation and make the phone ring. Dennis coaches young adult agency owners serving plumbers, AC technicians, landscapers, roofers, electricians, and believes there should be a standard in measuring local marketing efforts, much like doctors and plumbers must be certified.