Yes, with a lid-sleep override such as Clamshell or pmset disablesleep. Apple's closed-display mode needs power.
Clamshell for Mac keeps the Mac awake with the lid closed while armed. No sudo, no monitor. Free for 7 days, then $9.99 once.
Download free trialApple's closed-display mode is not a battery option: Apple's instructions for a closed laptop say it must be connected to power and to an external keyboard and mouse, with an external display. To keep a MacBook awake with the lid closed on battery, you need something that overrides lid sleep. Clamshell for Mac is a menu bar app that does this on battery or power, re-applies itself when you plug in or unplug, and can let the Mac sleep at a low-battery level you choose. pmset disablesleep and Amphetamine are the main alternatives.
Quick answer
Apple's clamshell mode
Requires power, an external display, keyboard and mouse. Not for battery use.
Clamshell
Works on battery and power, re-applies on every plug or unplug, optional Disarm on low battery (off by default), thermal safety always on. No sudo.
sudo pmset -a disablesleep 1
Works on battery because -a covers every power source, but has no low-battery or heat cutoff and stays on until you undo it.
Amphetamine
Free, with a Closed-Display Mode, low-battery session end, and battery and power-adapter triggers. On Apple Silicon, its developer recommends an optional Power Protect install for power-source changes.
Why Apple's clamshell mode does not help on battery
macOS supports running a MacBook with the lid closed as a desktop: connect a display, keyboard, mouse and power, and approve the accessories if your Mac asks. Apple's display troubleshooting says a closed-lid laptop must be connected to power and using an external keyboard and mouse. Without that setup, closing the lid starts lid sleep. caffeinate and most keep-awake apps block idle sleep only, so they do not change this on battery or on power. See why caffeinate does not work with the lid closed.
How each option behaves on battery
| Method | On battery | Plug or unplug | Battery cutoff | Admin |
|---|---|---|---|---|
| Apple's closed-display mode | No, needs power | Unplugging leaves the supported setup | Not applicable | No |
pmset -a disablesleep 1 |
Yes | Global flag, stays set | None built in | Yes, sudo |
| Amphetamine Closed-Display Mode | Listed feature; check on your Mac | Apple Silicon: optional Power Protect install recommended | Can end the session on low battery | App: no. Power Protect install: yes |
| Clamshell | Yes | Re-applies automatically | Optional, off by default | No |
pmset disablesleep on battery
-a applies a setting to all power sources, so sudo pmset -a disablesleep 1 keeps a closed Mac awake on battery too. That is the problem as much as the feature: nothing turns it off when the charge runs low or the Mac gets warm, and it remains set until you run sudo pmset -a disablesleep 0. Full pmset guide.
Amphetamine on battery
Amphetamine is free and mature. Its App Store listing includes keeping a MacBook awake with the display closed, ending a session when the battery is low, and triggers based on battery level or whether the power adapter is connected. Its developer notes that on Apple Silicon laptops Closed-Display Mode may not work as expected after connecting or disconnecting power, and offers Power Protect: a separate installer that asks for Touch ID or an administrator password and adds a file under /private/etc/sudoers.d/. If you already use Amphetamine and are comfortable with that install, it is a reasonable choice, and its trigger system is more flexible than Clamshell's.
Clamshell on battery
Clamshell overrides lid sleep with the unprivileged IOKit clamshell sleep control plus an idle-sleep assertion while armed. It watches for power-source changes and re-applies itself on every plug or unplug, because macOS can clear lid-sleep overrides on those transitions. Nothing extra to install and no admin prompt. The setting never survives a restart.
Clamshell for Mac keeps a closed MacBook awake on battery or power, with an optional low-battery cutoff. Free for 7 days, then $9.99 once for one Mac.
Download free trialSet a low-battery cutoff
In Clamshell's General settings, turn on Disarm on low battery and pick a level between 5% and 50%; the default is 20%. It is off until you enable it. While armed on battery, if the charge falls through that level, Clamshell disarms and posts a notification, so normal lid sleep applies and the Mac can sleep instead of running flat.
- Armed on batteryThe closed Mac keeps working as the charge falls.
- The charge falls through your levelClamshell disarms and posts a notification.
- Normal lid sleep appliesThe Mac sleeps instead of running flat.
- If you deliberately arm while already below the level, Clamshell honors that and does not disarm immediately.
- If you armed on power and then unplug below the level, it disarms, because you did not choose that low charge on battery.
- If the switch is on and macOS stops reporting a charge level on battery, Clamshell fails toward letting the Mac sleep.
Whatever tool you use, a cutoff turns a flat battery into a paused job. Your work stops either way; with a cutoff, the Mac and its open files are still there when you get back.
What drains the battery with the lid closed
No tool makes closed-lid work free. Closing the lid switches off the built-in display, which removes a large share of a laptop's normal power draw, but the work itself draws what it always draws.
- Light work, such as an agent mostly waiting on network responses, a download, or an SSH session, is gentle on the battery.
- Heavy work, such as compiling, test suites, video exports or local AI models, can drain a battery quickly with the lid open or closed.
- Low Power Mode in System Settings under Battery reduces energy use to extend battery life, at some cost to performance. Apple lets you set it for battery only.
For anything longer than a short trip between outlets, plugging in is still the answer. Clamshell keeps working when you do.
Heat: never in a bag
A closed MacBook doing real work in a bag, a sleeve or under a blanket has little airflow, and the heat builds. Keep it on a hard surface with the vents clear. Clamshell's thermal safety is always on: at serious or critical thermal pressure, it disarms toward normal lid sleep and refuses to arm again until the Mac cools. It is a backstop, not a substitute for airflow.
Before you pack the Mac away, disarm it and check the menu bar shows it inactive; a session armed from the menu or by URL stays on until you disarm, while an Option-close session ends when you open the lid.
Requirements
Clamshell runs on Apple Silicon MacBooks with macOS 14 or later. The Option-close gesture needs the lid angle sensor in a MacBook Air M2 (2022) or later or a 14-inch or 16-inch MacBook Pro (2021) or later; other Apple Silicon laptops arm from the menu bar. It pauses instead of arming while an external display is connected. It is available from clamshell.dev and on Setapp, not the Mac App Store, where an unrelated app shares the name.
Frequently asked questions
Does Apple's clamshell mode work on battery?
No. Apple's guidance for a closed-lid laptop with an external display says the Mac must be connected to power and using an external keyboard and mouse. On battery with the lid closed, macOS starts lid sleep unless another tool overrides it.
Is there a Mac app that prevents sleep with the lid closed on battery?
Yes. Clamshell keeps an Apple Silicon MacBook awake with the lid closed on battery or power, without sudo, and re-applies itself when you plug in or unplug. Amphetamine offers a Closed-Display Mode with low-battery session end, and recommends an optional Power Protect install on Apple Silicon for power changes.
Does pmset disablesleep work on battery?
Yes. sudo pmset -a disablesleep 1 applies to all power sources, including battery. It has no low-battery or thermal cutoff and stays on until you run sudo pmset -a disablesleep 0.
Will a closed MacBook drain its battery overnight?
It depends on the work. Closing the lid turns off the built-in display, so light work uses little power, but heavy builds or local AI models draw as much as they do with the lid open. For overnight runs, plug in, or set a low-battery cutoff so the Mac sleeps before the battery runs flat.
What happens if I unplug while Clamshell is armed?
Clamshell stays armed and re-applies its lid-sleep override after the power change. If Disarm on low battery is on and the charge is already below your chosen level when you unplug, it disarms so the Mac can sleep normally.
Is it safe to keep a MacBook running in a bag with the lid closed?
No. A bag traps heat. Keep a working MacBook on a hard, ventilated surface, and disarm Clamshell before packing the Mac away. Clamshell disarms on serious or critical thermal pressure, but that is a backstop, not a substitute for airflow.
Related guides
- Use a MacBook with the lid closed without an external monitor
- Run AI coding agents overnight on a MacBook
- What pmset disablesleep does and how to undo it
- Compare Clamshell, Amphetamine, pmset and Apple's setup
- Keep Codex running when you close your MacBook lid
Sources checked September 29, 2026: Apple's external display guidance for a closed laptop, closed-lid accessory guidance and Power Modes article, the Amphetamine App Store listing, the Amphetamine Power Protect page, and the macOS pmset(1) manual. Clamshell behavior is described from its app source and FAQ. No battery life figures are given because none were measured for this page. Clamshell is the publisher of this guide. Product names belong to their respective owners.