Journal · Guide · 4 min

Keep a MacBook awake with the lid closed, safely

By Ziyarex ·

Every Mac user eventually wants this: close the lid, keep the machine working. A download that must finish, a build server in a backpack, a Plex box on a shelf. And every Mac user then discovers the same surprise, the usual tricks don't work.

Why caffeinate doesn't cut it

macOS treats a closed lid as a special case. Ordinary power assertions (caffeinate, IOKit assertions, most "keep awake" apps) prevent idle sleep, not clamshell sleep. Close the lid and macOS sleeps anyway, unless three things are attached: external display, power, and a keyboard or mouse. That's the supported "clamshell mode," and it assumes a desk.

What actually works

The lever that works with nothing attached is:

sudo pmset -a disablesleep 1

This disables sleep at the power-management level, lid open or closed. It's also a loaded tool: forget to turn it off (disablesleep 0) and your Mac will happily cook in a closed bag, because you've disabled the safety too.

The part nobody mentions: heat

A closed lid restricts airflow across the hinge vent. A MacBook doing real work with the lid shut runs meaningfully hotter than the same work lid-open. Sustained heat is the enemy of batteries.

If you do this manually, check the thermal state:

pmset -g thermlog

Or let something watch the temperature for you

This is exactly why we built Insomniac: it flips the same pmset lever, but pairs it with a live thermal-safety layer, it advises how long closed-lid is safe right now, and auto-stops before things get too hot. Free, menu-bar, one job.

Honest alternative: for every lid-open case, Amphetamine is the gold standard, more mature, endlessly configurable. The closed-lid case is the one place it needs workarounds, and the one place Insomniac exists.

Mentioned in this post