How to prevent your Mac from sleeping

By Matyas Rathonyi. Published November 23, 2026. Guides

You can prevent your Mac from sleeping for free while the lid stays open using System Settings or Terminal's caffeinate command, but Apple's own guide lists closing the display as a way to put a MacBook to sleep. To keep an Apple Silicon MacBook running after you close the lid, on battery or power and with no admin password, Clamshell for Mac does it from the menu bar for $9.99 once after a 7-day free trial.

Written by Matyas Rathonyi, the maker of Clamshell for Mac.

Three System Settings controls: the Lock Screen display timer set to Never, then the Battery option for the power adapter and the Energy option on a desktop Mac switching on. System Settings Lock Screen Never Battery > Options Energy (desktop)
Two kinds of setting.Lock Screen sets when the display turns off. The Battery and Energy options are what Apple describes for keeping the Mac from sleeping while the display is off.

Stop sleep in System Settings

Apple splits sleep control into two places: display timers under Lock Screen, and a switch that stops automatic sleep once the display turns off. The labels below match Apple's Mac User Guide for macOS 14 through macOS 27.

  1. Raise the display timers (MacBooks and desktops). Open Apple menu > System Settings > Lock Screen. Set Turn display off on battery when inactive and Turn display off on power adapter when inactive to a longer delay, or to Never. macOS 27.2.1's Lock Screen strings warn: "Never letting your display turn off may shorten its lifespan and increase energy usage." (Apple's macOS 14 and 15 guides also list Start Screen Saver when inactive here; Apple's macOS 26 and 27 pages do not.)
  2. Keep a plugged-in MacBook awake after the display turns off. Open System Settings > Battery, click Options, and turn on Prevent automatic sleeping on power adapter when the display is off. Apple describes it as: "Prevent your Mac from sleeping when it's plugged in and its display is off." Apple's Battery settings page lists no equivalent switch for battery power.
  3. Keep a desktop Mac awake after the display turns off. Open System Settings > Energy (named Energy Saver in macOS 14) and turn on Prevent automatic sleeping when the display is off.

Apple's sleep and wake guide also notes: "Keep in mind that delaying, preventing, or allowing disruption of sleep may increase power consumption."

Keep the screen on, or turn it off without sleeping

To keep the screen lit temporarily without editing your saved settings, run this in Terminal and press Control-C when you are done:

caffeinate -di

Apple's caffeinate(8) manual says -d creates an assertion to prevent the display from sleeping, and Apple's IOPMLib.h SDK header says that while the display is prevented from dimming, the system cannot go into idle sleep either.

To turn the screen off while your Mac keeps working (lid open):

  1. Set a way to darken the display. Open System Settings > Desktop & Dock > Hot Corners, pick a corner, choose Put Display to Sleep, and click Done. On built-in keyboards without Touch ID, Apple Support article 102650 also documents Control-Shift-Power button to put displays to sleep (on keyboards with Touch ID, pressing the power button locks the screen). In Terminal, man pmset documents pmset displaysleepnow to sleep the display immediately.
  2. Keep the Mac awake on power. Turn on System Settings > Battery > Options > Prevent automatic sleeping on power adapter when the display is off (or Energy > Prevent automatic sleeping when the display is off on a desktop).
  3. Keep the Mac awake on battery (lid open). Because Apple's Battery settings offer no battery-power switch, run caffeinate -i in Terminal (add -t for a limit in seconds, such as 3600 for one hour):
    caffeinate -i -t 3600

Apple's SDK header says of caffeinate -i's assertion: "The display may dim and idle sleep while kIOPMAssertPreventUserIdleSystemSleep is enabled, but the system may not idle sleep." Avoid -d or -u when you want the screen dark: -d keeps the display on and -u turns it back on if it is off.

Depending on System Settings > Lock Screen > Require password after screen saver begins or display is turned off, turning the display off can lock your Mac. If you connect an external monitor and want only your MacBook's built-in screen off, Apple's Displays settings list no switch for that; Apple documents closing the lid with power, an external display, and an external keyboard and mouse connected instead (see how to use a MacBook in clamshell mode).

Two bars over time. The display bar ends when the display turns off. The Mac bar keeps going, as Apple describes for the Battery option on power and for caffeinate -i. Display Mac display off
Display off, Mac awake. This is the split Apple describes for the Battery option ("plugged in and its display is off") and for the caffeinate -i assertion, which lets the display dim and sleep.

Keep a Mac awake for one job with caffeinate

caffeinate is built into macOS and needs no sudo. Its hold ends automatically when its timer expires, its wrapped command finishes, or you press Control-C.

caffeinate -i -t 3600
caffeinate -i sleep 4
caffeinate -i -w <PID>

The first command blocks idle sleep for one hour (3600 seconds). The second holds until the command finishes (replace sleep 4 with your own command). The third waits until an already-running process exits (replace <PID> with the process ID). Run pmset -g assertions to confirm the hold; see what caffeinate does on a Mac for every flag, or pmset -g explained to read the output.

If you want a free menu bar switch for lid-open use, two options exist, and both stop short at a closed lid:

Where every free lid-open fix stops: closing the lid

Every System Settings switch and caffeinate command above is built for an open lid. Apple's Mac User Guide lists "On a Mac laptop, close the display." as a way to put a laptop to sleep, Apple's SDK header says the Mac may still sleep for lid close under caffeinate -i and that the display still sleeps when you close the lid under -d, and Apple describes its Battery prevent-sleep switch for a plugged-in Mac with its display off, with no switch for battery power.

Free closed-lid workarounds ask for extra hardware or admin access, or end when the power changes. Apple's built-in closed-display mode requires a charger, an external monitor, and an external keyboard and mouse. Running sudo pmset -a disablesleep 1 asks for an admin password and turns sleep off until you undo it. Amphetamine's Closed-Display Mode ends when you plug in or unplug on Apple Silicon unless you install its Power Protect add-on, which also asks for an admin password to install.

Why pay $9.99 once for Clamshell when System Settings and caffeinate are free? The built-in tools stop when you close the lid, and free closed-lid workarounds require a desk monitor setup or an admin password and sudo rule, or drop the session when you plug in or unplug.

Test it on your Mac before paying anything: Download free trial (free for 7 days, no card required; $9.99 once for 1 Mac or $19.99 for up to 3 Macs, with a 14-day money-back guarantee). For every closed-lid route compared, see how to keep a Mac running with the lid closed.

Turn sleep back on

To restore normal sleep, set the Lock Screen Turn display off menus back to a shorter delay, turn off Prevent automatic sleeping on power adapter when the display is off (or the Energy option on a desktop), and stop any running caffeinate command or menu bar session. If your Mac still will not sleep, see Mac won't sleep or Sleep is greyed out.

When the built-in free tools are the better pick

Frequently asked questions

How do I stop my MacBook screen from turning off after 5 minutes?

Open System Settings > Lock Screen and raise Turn display off on battery when inactive and Turn display off on power adapter when inactive to a longer time. If you want to keep the screen lit for one session without changing saved settings, run caffeinate -di in Terminal and press Control-C when done.

How do I deactivate sleep mode on a Mac?

On a plugged-in MacBook, turn on System Settings > Battery > Options > Prevent automatic sleeping on power adapter when the display is off (on a desktop Mac, System Settings > Energy > Prevent automatic sleeping when the display is off). On battery with the lid open, raise the Lock Screen timers or run caffeinate -i. If you want to close the lid without sleeping, start Clamshell's 7-day free trial instead.

How do I stop a MacBook from dimming after 30 seconds?

Check System Settings > Battery > Options > Slightly dim the display on battery (which Apple describes as dimming the display when your Mac is not plugged in), and raise the Turn display off on battery when inactive timer under System Settings > Lock Screen.

What is the shortcut to turn off a Mac display without sleeping?

Apple Support article 102650 documents Control-Shift-Power button on built-in keyboards without Touch ID. On keyboards with Touch ID, pressing the power button locks the screen, so set a hot corner to Put Display to Sleep under System Settings > Desktop & Dock > Hot Corners, or use pmset displaysleepnow in Terminal, then keep the Mac awake with the Battery option on power or caffeinate -i on battery.

Does keeping a Mac awake use more power?

Yes. Apple's sleep and wake guide says delaying or preventing sleep may increase power consumption, and macOS 27.2.1's Lock Screen strings warn that never letting the display turn off may shorten its lifespan and increase energy usage. If you run a closed MacBook on battery with Clamshell, its 20% low-battery stop is on by default so it does not drain completely.

Does this work with the lid closed, and why pay $9.99 for Clamshell?

No, these System Settings and caffeinate steps are for an open lid, and Apple lists closing the display as a way to put a MacBook to sleep. Clamshell costs $9.99 once with no subscription so you can keep a closed Apple Silicon MacBook running on battery or power with no admin password, an always-on heat cut-off, and a 20% battery floor, and you can test it free for 7 days first.

Related guides

Try Clamshell free for 7 days

Keep your Apple Silicon MacBook running with the lid closed, on battery or power, with no admin password, an always-on heat cut-off, and a 20% battery floor. Normal lid sleep returns when you disarm or quit.

Download free trial $9.99 once, no subscription

$9.99 for 1 Mac, $19.99 for up to 3 Macs. 7-day free trial with no card required and a 14-day money-back guarantee. Apple Silicon, macOS 14 or later, notarized by Apple. Also available via Homebrew or Setapp.

Sources checked November 23, 2026: Apple Mac User Guide pages for sleep and wake, Lock Screen, Battery, Energy, Displays, and Hot Corners (macOS 14 to 27), Apple Support article 102650, macOS 27.2.1 caffeinate(8) and pmset(1) manuals, IOPMLib.h (macOS 27.0 SDK), macOS 27.2.1 Lock Screen and Desktop & Dock settings strings, the Amphetamine Mac App Store listing, and the KeepingYouAwake README. caffeinate commands were checked on macOS 27.2.1 without sudo. Clamshell details come from version 2.0.5. Clamshell is an independent app, not affiliated with or endorsed by Apple. Product names belong to their respective owners.