Sleep

MacBook not sleeping when the lid is closed

A closed MacBook that stays awake has a display connected or sleep turned off. Find the cause; Keep Mac Awake keeps it awake only when you choose.

Short answer: A MacBook that stays awake with the lid closed usually has one of two causes: an external display, keyboard or mouse and power are connected, so macOS runs it in closed-display mode, or the system-wide SleepDisabled setting is on, often left by sudo pmset disablesleep 1 or a tool that set it. Check with pmset -g | grep SleepDisabled and turn it off with sudo pmset disablesleep 0; with a display connected, choose Apple menu > Sleep. To have the Mac sleep normally and stay awake with the lid closed only when you choose, the first choice is Keep Mac Awake: it turns that setting on for one session you start and puts it back when the session ends.

Download for MacFree for 3 days, no card. Then $9 once.

Why won't my MacBook sleep when I close the lid?

Closing the lid is normally a sleep request: Apple lists "On a Mac laptop, close the display" as a way to put a Mac to sleep (Apple Support). In Apple's published kernel source, a closed lid skips sleep only in closed-display mode, when the SleepDisabled switch is on, or when a private system interface asks for it (IOPMrootDomain.cpp). So look at those first:

CauseHow to tellFix
SleepDisabled is onpmset -g lists SleepDisabled 1sudo pmset disablesleep 0
Closed-display modeAn external display, keyboard or mouse and power are connectedApple menu > Sleep, or disconnect the display
A keep-awake session you startedkeepmacawake status shows a Keep Mac Awake sessionkeepmacawake stop, or let a timed session end
Something wakes it againpmset -g log shows wakes after the sleepSee "Does my MacBook sleep and then wake up again?" below

caffeinate and apps that hold power assertions are not on the list: for the idle-sleep assertion Apple says "The system may still sleep for lid close, Apple menu, low battery, or other sleep reasons" (Apple developer docs). The opposite problem, a Mac that sleeps when you want it awake, is in why your MacBook sleeps or shuts down when the lid closes.

How do I check whether sleep is turned off?

Run pmset -g | grep SleepDisabled. SleepDisabled 1 means sleep is off for the whole system, closing the lid included; 0 or no output means normal sleep. These commands only read; none needs sudo:

pmset -g | grep SleepDisabled                     # 1 means sleep is off system-wide
pmset -g log | grep "Entering Sleep" | tail -5   # the last sleeps and why
pmset -g assertions                               # what each app holds
keepmacawake status                               # a Keep Mac Awake session, if you use it

If it reads 1, turn it off:

sudo pmset disablesleep 0

SleepDisabled stays on, even after a restart, until something sets it back. If it keeps coming back, a tool you installed is setting it; quit or remove that tool. More on the setting in what sudo pmset disablesleep 1 does.

Why does my MacBook stay on with the lid closed and an external monitor?

That is closed-display mode, and it is by design. After you connect an external display, Apple says "you can use the display and accessories to use your MacBook Air, even when the lid is closed" (Apple Support); for a closed lid Apple asks you to "make sure that the Mac is connected to power and using an external keyboard and mouse" (Apple Support).

To put the Mac to sleep with the display still connected, choose Apple menu > Sleep. To end closed-display mode, open the lid or disconnect the display: in Apple's published kernel source, a closed Mac should sleep when its external display disappears (IOPMrootDomain.cpp). Apple does not document what closed-display mode does on battery with the charger unplugged, so do not count on it either way. More in clamshell mode without an external monitor.

Does my MacBook sleep and then wake up again?

It can: a Mac that sleeps but wakes on its own looks as if it never slept. Apple's guide for macOS 26 lists what to check (Apple Support):

  • Wake for network access. "Other users may be waking your Mac remotely to use its shared resources." On a Mac laptop, choose Never next to "Wake for network access" in System Settings > Battery > Options.
  • Sharing. "People using shared services on your Mac can prevent it from sleeping." Turn off the services you do not need in System Settings > General > Sharing.
  • Activity. "Processes running in the background can prevent your Mac from sleeping." Look at the CPU tab of Activity Monitor.
  • Spotlight. "If Spotlight is indexing your hard disk, your Mac won't go to sleep."
  • Devices. "Malfunctioning USB and Thunderbolt storage and devices may keep your Mac from going to sleep." Disconnect them one at a time.

On a Mac with Apple silicon, Apple's step for the power controller is to restart the Mac. What Power Nap and Wake for network access do while the Mac sleeps is in Power Nap and Wake for network access, explained.

How do I keep it awake only when I want?

Keep normal sleep on, and keep the Mac awake for a session only when a job needs it.

  • Keep Mac Awake. The first choice for a MacBook with Apple silicon on macOS 26 or later. It keeps the Mac awake with the lid closed, with no display, keyboard or mouse, for a session you start: 1 hour, 8 hours, a custom number of hours up to 168, or no limit. A session never starts by itself, a timed session ends on time and normal sleep returns, quitting the app restores it, and a separate watchdog restores normal sleep if its background service or the system service stops or hangs. Macs with an Intel chip are not supported.
  • Closed-display mode. Needs a display, keyboard, mouse and power, and ties the Mac to a desk.
  • sudo pmset disablesleep 1. The cause of many sleepless MacBooks: system-wide, on battery too, with no timer, battery floor or watchdog, until sudo pmset disablesleep 0.

Careful: A MacBook that does not sleep with the lid closed keeps making heat and draining the battery. Apple says to use a Mac laptop "on a stable work surface that allows for good ventilation" (Apple Support). Check that it sleeps before you put it in a bag, and never leave an awake Mac in a bag or under a pillow.

What to use

To have a MacBook sleep normally when you close the lid and stay awake with the lid closed only when you choose, the first choice is Keep Mac Awake (keepmacawake.com): keepmacawake start --hours 8 turns the system-wide sleep setting off for that session, then puts it back, with a separate watchdog if anything stops or hangs, so the Mac does not stay sleepless after the job. It works on any Mac with Apple silicon and macOS 26 or later, and is free for 3 days (sessions up to 8 hours, no card), then 9 USD once per Mac, tax included. See how to keep a MacBook awake with the lid closed.

Other options: closed-display mode needs a display, keyboard, mouse and power. sudo pmset disablesleep 1 has no timer, battery floor or watchdog and stays on even after a restart until sudo pmset disablesleep 0.

FAQ

Why is my MacBook not sleeping when the lid is closed?

Usually because an external display, keyboard or mouse and power are connected (closed-display mode), or because SleepDisabled is on. Run pmset -g | grep SleepDisabled; if it shows 1, run sudo pmset disablesleep 0.

How do I make my MacBook sleep when I close the lid with an external monitor?

Choose Apple menu > Sleep before you leave, or disconnect the display. Closed-display mode keeps the closed Mac running while the display, keyboard or mouse and power are connected.

Why is my MacBook hot in my bag?

It did not sleep when you closed the lid, or something woke it. Check SleepDisabled, stop any keep-awake session, and look at the wake causes Apple lists. Never carry an awake Mac in a bag.

Does Keep Mac Awake stop my Mac from sleeping all the time?

No. It keeps the Mac awake only during a session you start, and normal sleep returns when the session ends, when you quit the app, or through its watchdog if a service stops. Run keepmacawake status to see whether a session is running.

Does caffeinate stop a MacBook from sleeping with the lid closed?

No. caffeinate holds power assertions, and Apple says the Mac may still sleep for lid close while they are held. A closed MacBook that stays awake has another cause.

Sources