Mac Field Guide

SettingsHow-to

How to keep a MacBook awake with the lid closed (clamshell mode)

Applies to macOS 14, 15, 26 and 27Reviewed 17 November 20262 min read

Short answer

A MacBook stays awake with the lid closed only in clamshell mode: it needs the charger, an external display, and an external keyboard or mouse. Connect all three, then close the lid, and the Mac keeps working on the external screen. Without an external display, closing the lid puts the Mac to sleep, and caffeinate and most keep-awake apps can't change that. Only a system setting can, either from Terminal or from an app that turns it on for you.

On this page
  1. Use clamshell mode
  2. The Mac still sleeps in clamshell mode
  3. Why most keep-awake apps can't override the lid
  4. Without an external display: the system setting
  5. Sources and further reading

Use clamshell mode

  1. Connect the charger.
  2. Connect an external display and check that it shows your desktop.
  3. Connect a keyboard and a mouse or trackpad, by USB or Bluetooth.
  4. Close the lid. The external display may go dark for a moment, then everything moves onto it.

To wake the Mac later, press a key or click the mouse. If the windows land on the wrong screen when you open the lid again, see choosing the main display.

The Mac still sleeps in clamshell mode

  • Check the charger. Clamshell mode needs power; on battery, a closed MacBook sleeps.
  • Check the display connection. If the monitor or a dock drops the signal, the Mac thinks it has no screen and goes to sleep. External monitor problems covers the usual causes.
  • Keep it awake while the external display is off. Open System Settings › Battery › Options and turn on Prevent automatic sleeping on power adapter when the display is off.

Why most keep-awake apps can't override the lid

The caffeinate command and simple keep-awake apps only stop the Mac from falling asleep when it's idle. Closing the lid is a direct request to sleep, like choosing Sleep from the Apple menu, so macOS sleeps anyway. To stay awake with the lid closed, an app has to switch on the system setting below, which needs your administrator approval once. Cruise Control does this for you, and turns it back off when it stops.

Without an external display: the system setting

There is a system setting that turns sleep off completely, including when you close the lid. Use it only for a specific job, such as a long upload with the Mac on a desk, and turn it back off afterwards.

  1. Open Terminal and run sudo pmset -a disablesleep 1. Enter your Mac's password when asked.
  2. Close the lid. The Mac keeps running.
  3. When you're done, run sudo pmset -a disablesleep 0 to turn normal sleep back on.

With this setting on, the Mac doesn't sleep in a bag either. It can get hot and drain the battery quickly. Don't forget to turn it off.

Sources and further reading

Applies tomacOS 27TahoeSequoiaSonoma

Reader tips

    No tips yet. If something else worked for you, or a step looks different on your Mac, add it here.

    Add a tip

    No links or email addresses. Tips are checked before they show. How we handle tips

    Keep reading