Does caffeinate work with a MacBook lid closed?

By Matyas Rathonyi. Updated November 23, 2026. Guides

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.

Two sleep paths. caffeinate guards one.Its assertion blocks the idle timer. Closing the lid is a separate trigger with nothing in its way, so the Mac goes straight to sleep.

Keep a closed MacBook awake instead: Clamshell for Mac in three steps

  1. 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.
  2. 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.
  3. 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.

Same command, two lids. 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

How to see the assertion

  1. Inspect active assertions. While caffeinate is running, open another Terminal window and run:
    pmset -g assertions
  2. Check the caffeinate line. You will normally see PreventUserIdleSystemSleep or another assertion owned by caffeinate. That confirms caffeinate is 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.

Clamshellcaffeinatesudo pmset -a disablesleep 1External display
Works lid closedYesIdle sleep onlyYesDesk setup only
No monitor neededYesYes (lid open)YesMonitor required
Admin stepNoneNonesudo on and offNone
Works on batteryYes, 20% floorLid open onlyYes, no battery stopPower required
Heat cut-offAlways onNoneNoneNone
Manual undo neededNone on disarm/quitEnds with jobRun disablesleep 0Unplug display
Price$9.99 once (7-day trial)FreeFreeFree (with monitor)
Mac and macOSApple Silicon, macOS 14+Any macOSAny macOSAny 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.

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:

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

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.

Download free trial $9.99 once, no subscription

$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.