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.

Applies to: Current macOS versions. Apple lists extra needs for two displays on MacBook Air and MacBook Pro with M3.Checked: 29 October 2026

Symptoms

  • A download or a long task stops when you close the lid.
  • The Mac goes to sleep each time you close the lid.
  • caffeinate keeps 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 caffeinate man page describes idle sleep and system sleep. It does not describe the lid.

How to check

  1. Make sure that an external display is connected and shows the desktop.

  2. Make sure that an external keyboard and a mouse or trackpad are connected.

  3. Make sure that the Mac gets power from the display or from its power adapter.

  4. See which processes hold sleep assertions now.

    pmset -g assertions

How to fix it

  1. Connect an external keyboard and a mouse or trackpad.

  2. Connect the Mac to power.

  3. Connect the external display. Wait until it shows the desktop.

  4. Close the lid. Continue to work on the external display.

  5. Before you close the lid, remove any camera cover, palm rest or keyboard cover from the Mac.

  6. If you do not have a display, keep the lid open while the task runs. Use caffeinate to stop idle sleep.

  7. Do not put a Mac that is awake into a bag. The Mac can get hot, and the battery can go flat.

With Kilobat

  1. Kilobat can keep a task running with the lid closed and no display. First, open Kilobat Settings › Awake & agents.

  2. Turn on Allow running with the lid closed. Approve the helper in System Settings › General › Login Items.

  3. Then keep one command running with the lid closed. The hold ends with the command.

    kilobat awake --lid-closed -- make release
  4. Or hold for a time, 8 hours at most.

    kilobat awake --lid-closed --for 2h
  5. The helper lets the Mac sleep at your battery floor, 20% by default, or when the Mac gets hot.

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

Sources checked on 29 October 2026. Man pages are the ones installed with macOS; open one with man <name> in Terminal.