Simpliguides

Simpliguides › macOS

How to change what happens when you close your MacBook lid

Close the lid on a MacBook and it goes to sleep. That is the only built-in behaviour, and System Settings has no switch that changes it. What you can do is keep the Mac running with the lid shut by connecting it to power and an external display — Apple calls this closed-display mode. This guide covers that. The Variations section covers keeping the Mac awake with no display at all, for a download or a long task that needs to finish. It uses the System Settings app, which means macOS Ventura or later.

What you'll need: A MacBook Air or MacBook Pro, its power adapter, an external display with a cable that fits the Mac (or a dock), and a keyboard and mouse or trackpad — wired or Bluetooth.

1

Plug in the power adapter

Connect the MacBook to mains power. On battery, closing the lid always puts the Mac to sleep, whatever else is plugged in.

A dock or monitor that supplies power over its USB-C cable counts, as long as the battery icon in the menu bar shows the Mac is charging.
2

Connect the external display

Plug the display into the Mac, either directly (HDMI, USB-C or Thunderbolt) or through a dock. Keep the lid open for now and check the display comes on, showing either your desktop or a copy of the built-in screen.

3

Connect a keyboard and mouse or trackpad

Plug in a USB keyboard and mouse, or pair Bluetooth ones under System Settings › Bluetooth. Once the lid is shut, these are how you wake the Mac and work on it.

4

Stop the Mac sleeping when the display switches off

Click the Apple menu, choose System Settings, then click Battery in the sidebar. Click Options…, turn on Prevent automatic sleeping on power adapter when the display is off, and click Done.

Without this, the Mac follows its display-off timer and drops into sleep a few minutes after the external display goes dark, closed lid or not.

On some versions of macOS the same switch also appears under Displays › Advanced… — turning it on in either place is enough. On macOS Monterey or earlier, look in System Preferences › Battery › Power Adapter for Prevent your Mac from automatically sleeping when the display is off.
5

Close the lid

Shut the lid. The external display may go black for a second or two while macOS rearranges the screens, then comes back showing your desktop across the whole of it. If it stays black, press a key or move the mouse.

6

Put it to sleep when you're done

With the lid shut, closing it is no longer how the Mac goes to sleep. Click the Apple menu and choose Sleep instead. To wake it again later, press a key or click the mouse.

Opening the lid at any point switches the Mac back to using its own screen, with the external display alongside it.

Variations

Keep the Mac awake with the lid shut and no display

There is no setting for this, but there is a Terminal command. Open Terminal (in Applications › Utilities), paste the line below, press Return, then type your login password — nothing shows on screen as you type it.

sudo pmset -a disablesleep 1

From then on, closing the lid does nothing: the built-in screen goes off, but the Mac carries on running. Two things to know before you rely on it. Sleep in the Apple menu stops working while this is on. And a closed MacBook that is still running gets warm, so don't put it in a bag until you have turned the setting back off:

sudo pmset -a disablesleep 0

Apple doesn't document this setting, so treat it as a workaround rather than a feature.

Use a menu bar app instead of Terminal

Amphetamine, free on the Mac App Store, adds a menu bar icon that keeps the Mac awake for a set time or until you switch it off. It has its own option for keeping the Mac awake with the lid shut, with the same warning about heat as the Terminal command above. It's the better choice if you want this now and then rather than permanently.

Change how long before the external display goes dark

Go to System Settings › Lock Screen and change Turn display off on power adapter when inactive. Pick a longer time, or Never, if the display keeps switching off while you are reading something.

Troubleshooting

The Mac goes to sleep anyway when I close the lid

Check the battery icon in the menu bar shows the Mac is charging. On battery, closing the lid always means sleep. If it is charging, check the display is plugged in directly or through a dock that carries video — some USB-C hubs only pass power and data. And give it ten seconds or so after closing the lid before deciding; the display normally goes black briefly first.

The external display stays black after I close the lid

Press a key or click the mouse. A Bluetooth keyboard or mouse sometimes can't wake the Mac from a deep sleep. If nothing happens, open the lid a little, wait for the external display to come back, then close it again. Also check the display is set to the input the Mac is plugged into.

The Mac feels hot or the fans are loud with the lid shut

Some extra warmth is normal in closed-display mode. Keep the Mac on a hard, flat surface with the hinge clear, not on a cushion or a pile of paper. If you used the Terminal command above to keep it awake with no display, turn that off again before packing the Mac away.

Advertisement

Need a calculator rather than a guide? Try Simplicalcs →