Sleep and power
Keep a Mac laptop working with the lid closed
Closing the lid puts a Mac laptop to sleep. With an external display and accessories connected, you can close the lid and continue to use the Mac.
Symptoms
- A download or a long task stops when you close the lid.
- The Mac goes to sleep each time you close the lid.
caffeinatekeeps the Mac awake, but closing the lid still puts it to sleep.
Likely causes
- The lid puts the Mac to sleep. Apple lists closing the display as one way to put a Mac laptop to sleep.
- No external display or accessories. Apple describes lid-closed use with a connected display and accessories.
- No power. For two displays with the lid closed on M3 models, Apple lists power from the display or a power adapter.
- Assertions do not cover the lid. The
caffeinateman page describes idle sleep and system sleep. It does not describe the lid.
How to check
Make sure that an external display is connected and shows the desktop.
Make sure that an external keyboard and a mouse or trackpad are connected.
Make sure that the Mac gets power from the display or from its power adapter.
See which processes hold sleep assertions now.
pmset -g assertions
How to fix it
Connect an external keyboard and a mouse or trackpad.
Connect the Mac to power.
Connect the external display. Wait until it shows the desktop.
Close the lid. Continue to work on the external display.
Before you close the lid, remove any camera cover, palm rest or keyboard cover from the Mac.
If you do not have a display, keep the lid open while the task runs. Use caffeinate to stop idle sleep.
Do not put a Mac that is awake into a bag. The Mac can get hot, and the battery can go flat.
With Kilobat
Kilobat can keep a task running with the lid closed and no display. First, open Kilobat Settings › Awake & agents.
Turn on Allow running with the lid closed. Approve the helper in System Settings › General › Login Items.
Then keep one command running with the lid closed. The hold ends with the command.
kilobat awake --lid-closed -- make releaseOr hold for a time, 8 hours at most.
kilobat awake --lid-closed --for 2hThe helper lets the Mac sleep at your battery floor, 20% by default, or when the Mac gets hot.
For AI agents, see Keep an agent running with the lid closed.
Questions
Does caffeinate work with the lid closed?
The man page describes idle and system sleep assertions only. Closing the lid still puts the Mac to sleep in usual use.
Can I use two external displays with the lid closed?
On MacBook Air and MacBook Pro with M3, Apple describes this setup. It needs an external keyboard and mouse or trackpad, and power.
Sources
- Apple Support: Put your Mac to sleep or wake it
- Apple Support: Connect an external display to MacBook Pro
- Apple Support: Use dual monitors with your MacBook Air and MacBook Pro with M3 chip
- Apple Support: Using a camera cover, palm rest, or keyboard cover on a Mac notebook
- caffeinate(8), man page installed with macOS 27.2
Sources checked on 29 October 2026. Man pages are the ones installed with macOS; open one with man <name> in Terminal.