No. caffeinate only blocks idle sleep; closing a MacBook lid triggers a separate sleep path that caffeinate does not override, so your Mac sleeps and stops your job as soon as the lid shuts. Clamshell for Mac keeps an Apple Silicon MacBook running with the lid closed, on power or battery, with no external monitor, no sudo, and nothing to undo, for $9.99 once after a 7-day free trial (no card required).
Written by Matyas Rathonyi, the maker of Clamshell for Mac.
Keep a closed MacBook awake instead: Clamshell for Mac in three steps
- Install Clamshell. Download the 7-day free trial from clamshell.dev, or run
brew install --cask clamshell, then open Clamshell once so it sits in your menu bar. - Arm it. Right-click the menu bar icon to stay armed until you disarm, or press both Option keys to arm for the next close only. Confirm the menu shows Armed or Armed for Next Close.
- Start your job and close the lid. Run your command as you would have with
caffeinate, then shut the lid. The display stays black while the Mac keeps running, and normal lid sleep returns when you disarm or quit.
Clamshell runs on Apple Silicon Mac laptops with macOS 14 or later, notarized by Apple, via clamshell.dev, Homebrew, or Setapp.
What caffeinate actually promises
The macOS caffeinate(8) manual says running caffeinate with no flags creates an assertion that prevents idle system sleep until the process exits. That works for a build, download, or terminal job when the lid stays open:
caffeinate -i make
caffeinate -i -w 12345
caffeinate -i -t 3600
The first blocks idle sleep while make runs. The second follows a process ID. The third expires after one hour. None of them changes what macOS does when you close the lid.
caffeinate -i make keeps idle sleep away while the lid is open. Close the lid and the separate lid-sleep path takes over, assertion or not.The flags do not mean closed-lid mode
-iprevents idle system sleep (the default) and does not override lid-close sleep.-srequests prevention of system sleep on AC power only, and the manual says nothing about closing the lid.-dprevents idle display sleep, the opposite of keeping the screen dark under a closed lid.-mprevents idle disk sleep and does not affect the lid.-udeclares user activity and can wake the display; it is not a lid override.
How to see the assertion
- Inspect active assertions. While
caffeinateis running, open another Terminal window and run:pmset -g assertions - Check the caffeinate line. You will normally see
PreventUserIdleSystemSleepor another assertion owned bycaffeinate. That confirmscaffeinateis running, and explains why the lid still sleeps the Mac: power assertions hold off idle timers, while closing the lid follows a separate policy.
What works instead
Once caffeinate stops at the lid, four options remain.
An external display
Apple's built-in closed-display setup needs an external monitor, power, and an external keyboard and mouse. It works for free at a desk and stops working the moment you unplug the monitor or run on battery. See clamshell mode without an external display.
An HDMI dummy plug
A dummy plug imitates a monitor in a port. Where it falls short: it is extra hardware to buy and carry, it occupies a port, macOS treats it as a real screen where windows can hide, and Apple's closed-display rules still expect power and external input devices.
sudo pmset -a disablesleep 1
This undocumented Terminal switch disables all sleep with no monitor. Where it falls short: it needs sudo and an admin password both to enable and to disable (sudo pmset -a disablesleep 0), applies on battery too, and has no timer, no menu bar state, no heat cut-off, and no battery stop. Forget to undo it and a closed Mac keeps running in a bag. See what pmset disablesleep does.
A purpose-built app
Clamshell for Mac keeps an Apple Silicon MacBook awake with the lid closed and while idle, only while armed, with its state visible in the menu bar.
| Clamshell | caffeinate | sudo pmset -a disablesleep 1 | External display | |
|---|---|---|---|---|
| Works lid closed | Yes | Idle sleep only | Yes | Desk setup only |
| No monitor needed | Yes | Yes (lid open) | Yes | Monitor required |
| Admin step | None | None | sudo on and off | None |
| Works on battery | Yes, 20% floor | Lid open only | Yes, no battery stop | Power required |
| Heat cut-off | Always on | None | None | None |
| Manual undo needed | None on disarm/quit | Ends with job | Run disablesleep 0 | Unplug display |
| Price | $9.99 once (7-day trial) | Free | Free | Free (with monitor) |
| Mac and macOS | Apple Silicon, macOS 14+ | Any macOS | Any macOS | Any MacBook |
Verdict: Choose Clamshell if you need your MacBook awake lid-closed with no monitor, no admin password, and automatic safety cut-offs; use caffeinate with the lid open, Apple's setup at a desk monitor, or pmset on an Intel Mac or macOS 13 and earlier.
What the free closed-lid command asks of you is typing sudo twice and remembering to undo an undocumented global switch with no menu bar reminder or heat check. Why pay $9.99 once for Clamshell? You skip admin passwords and manual undo while getting an always-on heat cut-off and a 20% battery floor out of the box.
- No sudo and nothing to undo. No admin password, no kernel extension, and no privileged helper. Normal lid sleep returns when you disarm, quit, or restart.
- Always-on heat cut-off and 20% battery floor. Serious or critical thermal pressure disarms toward normal lid sleep and blocks arming until the Mac cools. Low-battery disarm at 20% is on by default.
- Works on power and battery. Stays armed through every plug or unplug, with the display dark and Wi-Fi connected.
- Scriptable. Arm from the menu bar, both Option keys, Shortcuts, or
open "clamshell://arm"andopen "clamshell://disarm".
Try it on your Mac first: Download free trial (free for 7 days, no card required; $9.99 once for 1 Mac or $19.99 for up to 3 Macs, 14-day money-back guarantee).
The practical rule
The Mac stays open
Use caffeinate -i your-command. It is free, built into macOS, and ends automatically when your command exits.
The lid will close
Use a lid-closed tool instead of caffeinate. Clamshell covers lid-closed work and idle sleep while armed, with no monitor and no sudo, on Apple Silicon Macs running macOS 14 or later.
When a free route is the better pick:
- You can keep the lid open or stay plugged into a desk monitor.
caffeinateor Apple's display setup handles both for free. - You run an Intel Mac or macOS 13 or earlier. Clamshell requires Apple Silicon and macOS 14 or later.
Frequently asked questions
Does caffeinate work with the MacBook lid closed?
No. caffeinate prevents idle sleep only; closing the lid runs a separate sleep path so the Mac sleeps anyway. To keep an Apple Silicon MacBook running lid-closed with no monitor and no sudo, start Clamshell's 7-day free trial.
Does caffeinate -s keep a Mac awake with the lid closed?
caffeinate -s applies on AC power only, and Apple's manual says nothing about the lid. For dependable closed-lid runs on power or battery, use Clamshell for Mac.
Why does my Mac still sleep when caffeinate is running?
With the lid open, run pmset -g assertions to confirm the assertion exists and the command is still running. With the lid closed, lid-close sleep is the cause because caffeinate does not block it; switch to Clamshell for closed-lid work.
What should I use instead of caffeinate when the lid is closed?
Use Apple's monitor setup at a desk, sudo pmset -a disablesleep 1 if you accept admin rights and manual undo, or Clamshell for Mac, which needs no monitor, no sudo, and restores normal lid sleep when you disarm or quit.
Does Clamshell for Mac use caffeinate?
No. While armed, Clamshell for Mac keeps the Mac awake with the lid closed and while it sits idle, with no sudo or admin rights. Normal lid sleep returns when you disarm or quit.
Why pay $9.99 for Clamshell when pmset disablesleep is free?
sudo pmset -a disablesleep 1 is an undocumented global switch that needs sudo to turn on and off, runs on battery with no cutoff, and has no menu bar indicator or heat stop. Clamshell costs $9.99 once (no subscription) so you skip admin passwords and manual cleanup while keeping always-on thermal safety and a 20% battery floor. Try the 7-day free trial (no card required) first.
Related guides
- How to keep a MacBook awake with the lid closed
- How keep-awake apps keep a closed MacBook awake
- caffeinate and pmset command builder
- KeepingYouAwake with the lid closed: why it sleeps anyway
- Amphetamine not working with the lid closed
- Clamshell vs Amphetamine vs pmset for a closed MacBook lid
- Does Claude Code keep running when you close your laptop?
- Keep Codex running with the lid closed
- Keep AI coding agents running overnight on a MacBook
Try Clamshell free for 7 days
Replace caffeinate whenever the lid closes: no monitor, no admin password, an always-on heat cut-off, and a 20% battery floor. Normal lid sleep returns when you disarm or quit.
$9.99 for 1 Mac, $19.99 for up to 3 Macs. 7-day free trial with no card required and a 14-day money-back guarantee. Apple Silicon, macOS 14 or later, notarized by Apple. Also available via Homebrew or Setapp.
Method: checked against the macOS caffeinate(8) and pmset(1) manuals and pmset -g assertions on an Apple Silicon MacBook; caffeinate -s checked October 25, 2026. Clamshell details from version 2.0.5 and published documentation.