close the lid, and the download stops
updated · by Anton Shakirov
macOS treats a closing lid as «sleep now», and the only exception it ships with is clamshell mode — which needs an external display, power, and an input device. no monitor, no exception: caffeinate and the Prevent Sleep settings hold the Mac awake with the lid open, and none of them survive it closing. one system flag does, and it stays set long after you have forgotten you set it.
what macOS gives you for a closed lid
- System Settings → Lock Screen and → Displays hold the screen and the system awake while the lid is open — a long render you are sitting next to, and nothing else.
- caffeinate does the same from a command. still open-lid only.
- clamshell mode is the sanctioned closed-lid answer, and its conditions are the whole problem: an external display, power, and an input device. meet all three and it works; miss one and the Mac sleeps.
this is why the search results for this are full of apps: the case people actually have — a laptop on a desk, finishing something, lid closed to save space — is the one macOS does not offer a switch for.
the opposite complaint runs on the same machinery: why your Mac wakes up at night
does clamshell mode need power, and can a dummy plug fake it
yes, it needs power — Apple's instruction for a closed lid is an external keyboard and mouse or trackpad plus power, with one exception: if the display feeds the Mac over USB-C, a separate adapter is not needed.
the display itself can be faked. a dummy plug is a cheap HDMI or USB-C dongle with nothing behind it — it carries an EDID block, the small table a monitor uses to announce its resolutions, and macOS registers a display that is not there. clamshell then behaves normally. it is a real hardware answer, but it removes one condition of three: without power or an input device the Mac still sleeps.
Apple's requirements for running with the lid closed, including the USB-C power exception: Apple Support — use dual monitors with the lid closed
what caffeinate can and cannot hold
- -i holds off idle sleep, -d holds the display on, -m keeps the disk from idling down.
- -s prevents system sleep, and the man page is explicit: that assertion is valid only on AC power. on battery it does nothing.
- -w 4821 waits for that process to exit and releases the moment it does — the real answer to «hold until the download finishes». -t 3600 is the blunter version: expire after an hour.
- caffeinate -i make holds for as long as the command you handed it runs. -t is ignored in this form; the utility's own lifetime is the timer.
none of it survives a closing lid. that is not a bug: a lid is a direct instruction to sleep, and an assertion against idle sleep argues about idleness, which the lid never raises.
the built-in flag that keeps a MacBook awake with the lid closed
there is a power-management flag that makes the system ignore the lid entirely. it is real and it has worked for years, but it is undocumented: it appears nowhere in man pmset, and pmset -g cap does not list it among the settings the machine says it supports. it needs an admin password:
- sudo pmset -a disablesleep 1 — from now on, closing the lid does nothing.
- do the thing you needed the Mac awake for.
- sudo pmset -a disablesleep 0 — and this is the step that matters.
the catch is in the third line. the flag is sticky: it survives a reboot and stays set until you unset it by hand. a Mac that has been left on 1 does not sleep when you shut the lid and put it in a bag, and a laptop running at full tilt inside a closed bag gets hot enough to throttle, drain flat, and be unpleasant to hold.
there is a quieter catch. you set disablesleep, but the machine reports it back under another name: pmset -g prints SleepDisabled in its System-wide power settings block, and grepping that output for the word you typed returns nothing. same flag — the spelling of the question just differs from the spelling of the answer.
the fullest available account of what pmset actually controls, written outside Apple because the man page stops short: The Eclectic Light Company — power management in detail
if you leave it running behind a closed lid, watch what that does to the machine: check the cpu temperature on Apple silicon
so, plainly: for one evening at a desk the flag is the right answer and costs nothing — set it, use the Mac, unset it. the simple case ends the moment the machine moves. nothing will remind you, because as far as the system is concerned you asked for exactly this.
how hop keeps a MacBook awake with the lid closed
hop's keep-awake row is a duration, not a state. tap fifteen minutes, eight hours, or forever; when the time runs out — or when you quit hop — normal sleep comes back on its own, with no second command to remember.
- if you already run a free keep-awake app, keep it — as a keep-awake alone this is not a better one, and swapping tools to hold a lid open is not worth an afternoon.
- it holds with the lid closed — through the same flag, not around it. lid mode is a switch in the module's settings: hop asks for an admin password, sets disablesleep for the length of the hold, and puts it back to 0 when the time runs out or the app quits. the mechanism is the one above; what changes is who remembers the third command.
- the hold is bounded by default, so the failure mode is «it slept while I was away», not «it cooked in a bag overnight» — and the menu bar icon shows a hold you forgot about.
- the flag never outlives the session: the app restores it on exit, and if it was left at 1 by a crash, the next launch checks and reverts it before anything else — there is no state for a future you to find by hand.
what the module does, its options and its limits: keep your Mac awake
find out what is keeping your Mac awake
the reverse question is the more common one: the Mac is not sleeping and you never asked it to stay up. two commands answer two different questions, and mixing them up is why people decide the machine is haunted.
pmset -g assertions names the process
run pmset -g assertions and it lists every hold by pid and by name. on the Mac this page was written on it printed pid 32626 holding a NoIdleSleepAssertion named «Electron», and sharingd holding PreventUserIdleSystemSleep named «Handoff» — the file-transfer feature keeping the machine up to finish. plain pmset -g says it in one line: sleep 1 (sleep prevented by ...) and the names. not «something is preventing sleep», but which process, its own word for the hold, and how long it has held it.
one trap. the disablesleep flag never appears in the assertions list — it is a system-wide setting, not an assertion, and only pmset -g shows it. a Mac that stopped sleeping months ago looks perfectly innocent in pmset -g assertions while SleepDisabled quietly reads 1 in the other command's output.
a longer walk through hunting down a Mac that refuses to sleep: The Eclectic Light Company — dealing with the insomniac Mac
without Terminal: Activity Monitor → Energy has a Preventing Sleep column — right-click the headers if it is hidden. it knows only about apps, so it names fewer things, but it answers the everyday version of the question.
if the download you are holding the lid closed for never ends, measure the line before blaming sleep: test your internet speed without installing anything
when the Mac sleeps anyway, lid closed or not
- the battery ran out. nothing holds a Mac awake past empty, and a closed lid running a download is not a low-power state — plug it in. caffeinate -s does nothing on battery by design.
- caffeinate is running and the Mac slept the moment you shut the lid. expected, not broken: no assertion outranks the lid. only the disablesleep flag changes that.
- it got hot and throttled. a closed lid means the screen is off and the vents are where they always were; a long export under a stack of papers is a thermal problem, not a sleep one.
- the download stopped but the Mac stayed on. the app was suspended, not the system — some downloaders pause themselves when the display sleeps, and that is their setting to change.
- you set disablesleep weeks ago and forgot. run pmset -g and read the System-wide power settings block at the top: if SleepDisabled says 1, that is why. searching that output for «disablesleep» finds nothing, which is how people talk themselves into believing they never set it.
- you need it to wake and do something, not stay awake. that is a schedule — pmset repeat — a different tool for a different job.
Apple's own list of reasons a Mac sleeps or wakes when you did not ask it to: Apple Support — if your Mac sleeps or wakes unexpectedly
if the fans came up before the sleep did, the heat is the story: why your Mac fan is loud
if it did sleep and the tunnel came back dead: reconnect a vpn that drops after sleep
if what keeps you at the desk is a vpn that drops the moment the Mac sleeps: a vpn that says connected and carries nothing
frequently asked questions
- can a MacBook stay awake with the lid closed and no monitor?
- not with the shipped settings — clamshell mode requires an external display, power and an input device. it takes either the pmset disablesleep flag or an app that holds the same behaviour for you.
- does caffeinate work with the lid closed?
- no. caffeinate prevents idle sleep; a closing lid is a direct instruction to sleep and outranks it. no combination of its flags changes that.
- how do i keep the Mac awake until a download finishes?
- caffeinate -w followed by the process id: the hold is released the moment that process exits. caffeinate -i alongside the command itself does the same for anything you start from Terminal. both are still open-lid only.
- is it bad for the Mac to run with the lid shut?
- on a desk with air around it, no. in a bag it is genuinely bad: the heat has nowhere to go, the machine throttles and the battery empties. the risk is not the lid, it is the enclosure.
- how do i undo pmset disablesleep?
- sudo pmset -a disablesleep 0. check it with pmset -g, where it is printed as SleepDisabled at the top of the output — not as disablesleep. the flag survives reboots, so a Mac that stopped sleeping months ago is usually still carrying it.
- why does pmset -g assertions not show disablesleep?
- because it is not an assertion. assertions are holds taken by processes and released when they exit; disablesleep is a system-wide setting written into power management, and only pmset -g reports it.
- does hop leave anything behind if i quit it?
- no. the hold ends when the timer ends or the app quits, and sleep behaves exactly as it did before. in lid mode hop does write the disablesleep flag — the same one described above — but it sets it back to 0 on its own, on exit and again at the next launch if a crash left it set.
the tool behind this
keep awakedownloads, renders and calls run to the end. even with the lid closed.done with awake
other things people do
- 7z your Mac opens. rar it will not.archives
- a folder of heic, and something that wants jpgfile converter
- forty documents, and Word is not installedfile converter
about the author

Anton Shakirovmakes hop
makes hop and every page on this site. eighteen tools under a single menu bar icon, MIT licensed and open source. reads and answers issues and email himself.