UnIdle Journal
Download

The 23:52 problem: what macOS does when you shut the lid mid-run

You start a long agent run, close the laptop, and come back to a dead session. The agent didn't fail. The Mac went to sleep and took the run with it.

The problemOn battery, closing the lid sleeps the Mac at once. The agent's connection to its model drops, and the run is lost.
Without an appClamshell mode (needs power and an external display), or a Terminal command you must remember to undo.
What UnIdle addsIt runs that command for you, only while an agent is working, and undoes it the moment the work is done.

What actually happens

On a MacBook running on battery, closing the lid puts the system to sleep almost immediately. Every process is frozen in place, including the terminal your agent is running in.

The agent was in the middle of a streaming connection to its model. While the Mac sleeps, nothing answers on that connection, and on the far end it times out. When you wake the Mac, the stream the agent was reading from is gone. Depending on the tool, it errors out, retries from the start, or waits for input that will never arrive.

Why caffeinate doesn't help

caffeinate and every app built on the same mechanism work by asking macOS not to idle-sleep. That covers you walking away from an open laptop. It doesn't cover the lid: lid-close sleep on battery is not an idle decision, and those requests don't override it.

Option one: clamshell mode

macOS keeps a closed MacBook awake when it's connected to power, an external display, and an external keyboard or mouse. If that's your desk setup, you're already covered. It doesn't help on a train or in a bag.

Option two: turn sleep off entirely

From Terminal, this disables system sleep, including on lid close:

sudo pmset -a disablesleep 1

And this turns it back on:

sudo pmset -a disablesleep 0

It works, but it's a global switch. Forget the second command and your Mac never sleeps again — including in a bag with the lid shut, where it has no airflow, runs warm, and drains the battery. Only use it while you're actually waiting on a run.

Where UnIdle fits

Option two is the right fix with the wrong ergonomics: a password every time, and a Mac that never sleeps if you forget to undo it. UnIdle Pro does it for you, narrowly:

  • Lid sleep is switched off only while an agent is actually working — and switched back on the moment it stops.
  • One password, once, to install a small helper. No Terminal, nothing to remember.
  • If UnIdle ever quits mid-run, the helper turns sleep back on at once.
  • When the run finishes — or Claude Code needs a yes — you get a notification on your Mac, or with Pro, on your phone.
See how it works →Free to download. Pro is $12 once, with a 14-day free trial.