slowlp
← Blog
Tip 2026.07.02 · 2 min read

Why You Can't Close Your MacBook While Running an Agent — How I Started Using Amphetamine

Tip

Keeping your MacBook cracked open while an agent is running — that’s already become a meme. Close the lid, and it drops into sleep mode, killing the entire job mid-run.

My first instinct was to fix it from the terminal. sudo pmset -b sleep 0 disables sleep entirely. But the battery drains fast — obviously, since the machine is just running wide open. And when the job finishes, you have to remember to run sudo pmset -b sleep 1 again. Forget once, and your Mac quietly chews through the battery until 3 AM.

Amphetamine is a free Mac App Store app. It does exactly one thing: blocks sleep mode for however long you tell it to. Set it for two hours, four hours — whatever you need. When the timer runs out, it resets itself automatically.

One click in the menu bar to start a session. Set the timer to your estimated agent run time plus 30 minutes. When it’s done, there’s nothing to clean up — no commands to reverse, and your battery stays intact. You can finally stop leaving the lid propped open.

COMMENTS