MacPipYour next Mac app is here.macpip.com →

How to keep your Mac awake with the lid closed

Updated 22 October 2026

Close a MacBook’s lid and it sleeps. That’s usually what you want, but not when a download, a render, a backup or an AI agent is still running.

There are three honest ways to keep it going: clamshell mode (Apple’s way, with an external display), a Terminal command that turns sleep off, or an app that does that for you with a safety net. Here’s what each one does, and when to use it.

The short version

  • With an external display: clamshell mode is built in. Plug in power, a display and a keyboard or mouse, then close the lid.
  • caffeinate keeps an open Mac awake, but it doesn’t stop lid-close sleep on its own.
  • sudo pmset -a disablesleep 1 keeps it awake with the lid closed, even on battery. Undo it with sudo pmset -a disablesleep 0.
  • Never put a running, closed MacBook in a bag: it can’t cool itself, and it can drain the battery.
  • Apps like Amphetamine wrap this with timers and a menu-bar switch.

Which way fits you

Lid openLid closed + displayLid closed, no display
caffeinateYesNoNo
Clamshell modeYesOn powerNo
pmset disablesleepYesYesYes
What stays awake where. With an external display, clamshell mode is Apple’s own way.

Cozier hours at your Mac

Waiting on a long job? Clacky makes the time at your desk cozier: click and keyboard sounds, and a little harbour town that grows while you work. $4.99 once for 1 Mac.

Clamshell mode (Apple’s way)

If you use your MacBook with an external display, this is the built-in, supported way. Apple’s requirements:

  1. Connect the power adapter.
  2. Connect an external display, and an external keyboard and mouse or trackpad.
  3. Close the lid once the Mac is awake and showing on the display.

The Mac keeps running on the external display. On newer macOS versions you may have to allow a new accessory to connect before it works with the lid closed.

Sources: Apple: use an external display with your Mac laptop · Apple: allow accessories to connect

Also worth knowing: System Settings → Battery → Options has Prevent automatic sleeping on power adapter when the display is off. It stops the Mac sleeping when the screen turns off on its own. It doesn’t stop lid-close sleep. Apple: sleep and wake settings

caffeinate (built in, lid open)

caffeinate is a Terminal command that ships with macOS. It holds the Mac awake while it runs:

caffeinate -dis            # keep the display and the system awake until you press Ctrl-C
caffeinate -i -t 3600      # stay awake for one hour
caffeinate -i -w 12345     # stay awake until process 12345 ends

-d keeps the display on, -i stops idle sleep, -s stops system sleep (only on power), -t sets a time limit in seconds and -w waits for a process. It’s great with the lid open. Closing the lid is a different kind of sleep, and caffeinate alone doesn’t stop it, especially on battery.

Source: man caffeinate (online copy)

pmset disablesleep (lid closed, no display)

This one really does keep a MacBook running with the lid shut, with or without power:

sudo pmset -a disablesleep 1   # never sleep, even with the lid closed
sudo pmset -a disablesleep 0   # back to normal

It asks for your password because it changes a system power setting, and it stays on until you turn it back off, even after a restart. That’s the risk: forget it, close the lid, put the Mac in a bag, and it keeps running with no airflow, getting hot and draining the battery.

So if you use it:

  • Set a reminder to run the 0 version.
  • Keep the Mac on a hard surface, open to the air, ideally on power.
  • Check with pmset -g: SleepDisabled 1 means it’s still on.

Source: man pmset (online copy)

Apps: the same, with a safety net

Apps wrap these switches with timers, a menu-bar switch and limits.

  • Amphetamine is free on the Mac App Store and can be set to allow staying awake when the display is closed.

Before you rely on an app with the lid closed, check what it does on battery and whether it turns sleep back on when it stops.

Whatever you use: a closed MacBook that’s awake is still running. Give it air.

Questions

Does caffeinate keep my Mac awake with the lid closed?

Not reliably. caffeinate stops idle sleep, and -s stops system sleep on power, but closing the lid is handled separately. Use clamshell mode (with a display) or pmset disablesleep.

Is it bad to run a MacBook with the lid closed?

Running it on a desk with an external display is normal (that’s clamshell mode). The risk is a closed, awake Mac with no airflow, like in a bag or under a pillow: it can get hot and drain the battery.

How do I undo pmset disablesleep?

Run sudo pmset -a disablesleep 0. Check with pmset -g: if SleepDisabled shows 0, sleep is back to normal.

Will my Mac stay awake on battery with the lid closed?

Clamshell mode needs power. pmset disablesleep works on battery too, which is exactly why you should plug in, or keep an eye on the battery and turn it off when you’re done.

New to Clacky? It’s a cozy Mac menu-bar app with click and keyboard sounds, a screen recorder, screenshots and a little harbour town that grows while you work. See every tool · Hear the sounds in your browser

Checked on 22 October 2026. Something changed, or something here is wrong? Email hello@clacky.app.