Skip to content
Edith

Guide

How to Keep a MacBook Awake With the Lid Closed

Three built-in ways, what each one really does, and a safer switch for closed-lid sessions.

Updated by

The short answer

A MacBook goes to sleep when you close the lid. macOS only skips that sleep in closed-display mode, which needs power, an external display and an external keyboard or mouse. Without those, the only way to keep a MacBook awake with the lid closed is to turn system sleep off with pmset, either by hand or with a tool that does it for you, such as Edith's keep MacBook awake with the lid closed extension, Lid Awake.

This guide walks through the three built-in options first, says plainly where each one stops working, and then shows the Lid Awake setup with its real commands. Everything here applies to Apple silicon MacBooks on macOS 14 or later.

Method 1: closed-display mode

Built into macOS

Use an external display, power and a keyboard

Apple's guide Connect an external display to MacBook Pro says you can close the lid and keep working once an external display and accessories such as a keyboard and mouse are connected. Apple's dual-display instructions add that the Mac has to be connected to power.

  1. Connect the Mac to its power adapter.
  2. Connect and power on the external display.
  3. Connect a keyboard and a mouse or trackpad.
  4. Close the lid once the external display shows your desktop.

This is the cleanest option at a desk, because nothing about your power settings changes. It does nothing for a MacBook in a bag, on a couch or on battery: unplug the display or the power and the Mac sleeps as soon as the lid is shut.

Method 2: caffeinate

caffeinate ships with every Mac and is the right tool when the lid stays open. It holds a power assertion for as long as it runs, or for as long as another command runs.

Terminal
caffeinate -dcaffeinate -i -t 3600caffeinate -scaffeinate -i make releasepmset -g assertions
  • -d keeps the display awake, -i stops idle sleep, and -s stops system sleep while the Mac is on AC power.
  • -t 3600 lets go after an hour. Passing a command, as in caffeinate -i make release, holds the assertion until that command exits.
  • pmset -g assertions lists every app currently holding the Mac awake, which helps when a Mac will not sleep and you do not know why.

What caffeinate does not do is keep a MacBook with no external display running once you close the lid: closing the lid still puts it to sleep. If your build or download dies the moment you shut the lid, this is why.

Method 3: pmset disablesleep

Built into macOS, undocumented

Turn system sleep off with pmset

pmset has a disablesleep setting that stops the Mac from sleeping at all, including when the lid closes. It is not listed in man pmset, so treat it as unsupported, but it has worked for years and it needs an administrator password.

Terminal
sudo pmset -a disablesleep 1pmset -gsudo pmset -a disablesleep 0

The first line turns sleep off, pmset -g shows a SleepDisabled line set to 1 while it is active, and the last line turns normal sleep back on.

Where the built-in methods fall short

  • Closed-display mode needs a desk setup. It is not an option on battery or away from a monitor.
  • caffeinate keeps an open Mac awake but does not survive a closed lid.
  • pmset disablesleep works with the lid closed, but it has no timer, no battery limit and no reminder. If you forget the second command, the Mac stays unable to sleep until you undo it, and a MacBook that cannot sleep in a bag gets hot and drains to zero.

The Edith way: Lid Awake

Lid Awake sets the same disablesleep switch through a small helper you approve once, and wraps it in the parts that are missing: a session length, a battery floor and an automatic return to normal sleep. You control it from its card on Edith's Home, the Lid awake switch in the sidebar, or its settings.

  1. 1

    Install Lid Awake

    Open Library in Edith's sidebar, find Lid Awake and press Install. A Lid Awake card appears on Home.

  2. 2

    Approve the helper once

    The first time you turn it on, macOS asks you to allow Edith's background helper in System Settings, under Login Items. After that, Lid Awake changes the setting without asking for your password again.

  3. 3

    Set a battery floor

    In Lid Awake's settings, set Auto-pause below to 10%, 20% or 30% battery. On battery, Lid Awake pauses at that level until the Mac is charged, so a forgotten session cannot run it flat.

  4. 4

    Choose how long

    Pick How long: Indefinitely, 15 minutes, 30 minutes, 1 hour, 2 hours or Until lid reopens. Lid Awake turns itself off after that.

  5. 5

    Turn it on, and off again

    Press Keep awake on the Lid Awake card on Home, or switch on Keep running with lid closed in its settings. The card shows Lid sleep as Disabled while it runs. Press Restore sleep when you are done.

From the terminal

The same flow as a script. on prints a preview with the heat warning until you add --yes:

Terminal
ed lid-awake battery 20ed lid-awake on --until-lid-reopens --yesed lid-awake statused lid-awake off

Restore normal sleep when Edith quits is on by default, so quitting Edith puts normal lid-close sleep back. Also by default, when Edith's battery saver is on, for example in Low Power Mode, and the Mac is on battery, Lid Awake turns itself off and comes back when you plug in or battery saver ends. The Keep awake even on low battery setting changes that.

Lid Awake or Keep Awake?

Edith has two sleep extensions and they solve different problems. Keep Awake stops idle sleep for the Mac and its display while the lid is open, much like caffeinate -d with an on and off switch. Closing the lid still sleeps the Mac. Lid Awake is the one for a closed lid. Use Keep Awake while you work at the desk, and Lid Awake for builds, downloads and agent runs that should continue after you walk away.

Common questions

Does the screen stay on with the lid closed?

No. The built-in display turns off when the lid closes. The Mac keeps running, so network transfers, builds and terminal sessions continue.

Will my Mac sleep normally afterwards?

Yes. When a session ends, hits the battery floor or you press Restore sleep, Lid Awake sets disablesleep back to 0. You can confirm with pmset -g.

What is a good use for this?

Long jobs you start before leaving the desk: a large download, a test suite, or coding agents working through a task list. The run coding agents overnight setup combines Lid Awake with agent and usage tracking.

One app. Every tool your Mac is missing.

Pay once · No account · 30-day refund · macOS 14+ on Apple silicon