The settings that decide when a Mac sleeps
On macOS 15 Sequoia, macOS 26 Tahoe and macOS 27, a Mac goes to sleep after it's been idle with the display off. So the main control is the display timer, in Lock Screen settings (Apple, Set sleep and wake settings for your Mac):
- Open System Settings and click Lock Screen in the sidebar.
- Use the pop-up menu next to Turn display off on power adapter when inactive, and on a MacBook the one next to Turn display off on battery when inactive, to choose a longer time.
- If you choose Never, macOS 27 warns: "Never letting your display turn off may shorten its lifespan and increase energy usage." On a desktop Mac the setting is a single Turn display off when inactive.
Then the setting that lets the display go dark while the Mac keeps working:
- MacBook: System Settings › Battery › Options, turn on Prevent automatic sleeping on power adapter when the display is off. As the name says, it only works on the adapter. On battery, the Mac still sleeps once the display has turned off.
- Desktop Mac: System Settings › Energy, turn on Prevent automatic sleeping when the display is off.
The paths are the same on macOS 15, 26 and 27. Apple's guide adds a reminder worth keeping in mind: "delaying, preventing, or allowing disruption of sleep may increase power consumption".
Screen saver and password settings
Two related settings often get mixed up with sleep:
- The screen saver. On macOS 15 its timer, Start Screen Saver when inactive, is in Lock Screen settings. On macOS 26 and 27 it moved to System Settings › Wallpaper › Screen Saver, where it's called Start Screen Saver. A screen saver doesn't stop the Mac from sleeping later; it just runs until the display turns off.
- The password. Require password after screen saver begins or display is turned off, in Lock Screen settings, decides how soon the Mac locks. If you keep the display on longer for a presentation or a dashboard, the Mac also stays unlocked longer, so choose this one with care (Apple, Change Lock Screen settings).
Keep it awake for now with caffeinate
caffeinate is built into macOS (/usr/bin/caffeinate). It asks macOS not to sleep for as long as it runs, then lets go, so nothing in System Settings changes. It doesn't need sudo. Open Terminal from Applications › Utilities and type:
caffeinate
With no options, the manual page says it "creates an assertion to prevent idle sleep". The Mac stays awake until you press Control-C or close the Terminal window. The useful variations:
caffeinate -d
caffeinate -t 3600
caffeinate -di -t 7200
caffeinate -i make
-dkeeps the display awake too, for a presentation or a dashboard.-t 3600stops after 3,600 seconds (an hour), so you can't forget it.-iprevents idle sleep; it's whatcaffeinatedoes by default.-di -t 7200combines them: display and idle sleep held off for two hours.-i makekeeps the Mac awake for as long as that command runs, then stops. Put any long command (a backup, a download script) in place ofmake.-wfollowed by a process ID waits for that process to finish. Find the ID withpgrep -land part of the app's name.-sprevents system sleep, but the manual page notes it "is valid only when system is running on AC power".
To check it's working, run this in a second Terminal window. It only reads:
pmset -g assertions | grep caffeinate
While caffeinate -di -t 8 ran on our MacBook Pro with macOS 27.0.1, it showed two lines, PreventUserIdleSystemSleep and PreventUserIdleDisplaySleep, both named "caffeinate command-line tool", with the detail "caffeinate asserting for 8 secs". After the eight seconds they were gone, and when we ended another run early, its assertion disappeared at once.
Apps that keep a Mac awake
If you prefer a menu bar control, two options are:
- Amphetamine: timed sessions and automatic triggers.
- KeepingYouAwake: a small open-source wrapper around the built-in
caffeinate.
For a fuller comparison of built-in and app controls, see Amphetamine, Caffeine or caffeinate. No extra app is needed if the settings or command above meet your needs.
What about closing the lid?
Apple lists closing the display as one of the ways to put a Mac laptop to sleep (Apple, Put your Mac to sleep or wake it), and none of the settings above changes that. The supported way to keep working with the lid closed is closed-display mode, with an external display, keyboard and mouse, and power: how to use a MacBook with the lid closed covers it. Wherever it runs, Apple's safety guidance is to keep a working Mac on a stable surface "that allows for adequate air circulation under and around the computer", not on a bed or under bedding (Apple, Important safety information).
What staying awake costs
Sleep uses very little power; an awake Mac with its screen on uses much more. Apple's environmental report for the 13-inch MacBook Air with M5 puts sleep at 0.22 W and idle with the display on at 3.69 W, measured at 115 V (Apple). Over an eight-hour night, that's roughly 1.8 Wh asleep against 29.5 Wh awake with the screen on. Those are wall-input calculations, including adapter losses, not a measurement or prediction of battery discharge. The arithmetic uses Apple's idle figures; a Mac that's actually working uses more, and one with its display off uses less.
So on battery, keep the Mac awake only as long as you need: caffeinate -t or a timed session in an app ends by itself. On the adapter, the cost is electricity rather than battery, and for a MacBook that's plugged in all day, a charge limit is worth a look.
If your Mac won't sleep when you want it to
The opposite problem has the same cause: something holding an assertion. Activity Monitor's Energy tab has a Preventing Sleep column, and pmset -g assertions lists every process that's holding the Mac awake. A forgotten caffeinate in another Terminal window is a common one. Why your MacBook loses charge while it's asleep explains how to read that list, and the sleep log, in detail.
How Tend helps
Keeping a Mac awake is easy; knowing what it cost is harder. Tend's free energy history shows your Mac's power draw over the last 24 hours (30 days with Pro), so you can see what a night of downloads or a long presentation used, and its Energy & Apps list shows which apps were busy, in estimated watts. Tend doesn't keep the Mac awake itself; use the settings or caffeinate for that.
Questions
How do I stop my Mac from going to sleep?
Open System Settings › Lock Screen and set the Turn display off menus to a longer time or Never. On a MacBook, also turn on Prevent automatic sleeping on power adapter when the display is off, in Battery › Options. On a desktop Mac, that setting is in Energy.
How do I keep my Mac awake without changing settings?
Open Terminal and type caffeinate. The Mac stays awake until you press Control-C or close the window. Add -d to keep the display on, or -t followed by a number of seconds to stop automatically.
Does caffeinate work on battery?
Yes, for idle sleep and display sleep (the -i and -d options). The -s option, which prevents system sleep, only works on AC power, according to its manual page. Closing a MacBook's lid still puts it to sleep.
Is it bad to never let a Mac sleep?
It uses more energy, and on battery it drains the charge much faster than sleep does. macOS also warns that never letting the display turn off may shorten its lifespan. Let the display turn off, and keep the Mac awake only when you need it.
How do I keep my MacBook awake with the lid closed?
Use closed-display mode: connect an external display, a keyboard and mouse or trackpad, and power, then close the lid. Without an external display, closing the lid puts a MacBook to sleep.
Related guides
How to use a MacBook with the lid closed (clamshell mode)
Keep working with the lid shut, on an external display
Why your MacBook loses charge while it's asleep
What wakes it, and what keeps it awake
Why is my MacBook battery draining so fast?
The usual causes, and how to find the app
How many watts does a MacBook use? Measured
Idle, sleep and busy, in watts
Sources
- Apple, Set sleep and wake settings for your Mac (macOS 15, 26 and 27)
- Apple, Change Lock Screen settings on Mac (macOS 15, 26 and 27)
- Apple, Change Battery settings on a Mac laptop and Change Energy settings on a Mac desktop computer
- Apple, Change Screen Saver settings on Mac
- Apple, Put your Mac to sleep or wake it (macOS 27)
- Apple, MacBook Air (M5) Product Environmental Report, March 2026
- Apple, Important safety information for your MacBook Air
- Amphetamine on the Mac App Store; KeepingYouAwake on GitHub, both checked 20 October 2026
man caffeinateandman pmset, andpmset -g assertionson a MacBook Pro (M2 Max) with macOS 27.0.1; Lock Screen settings text read from macOS 27.0.1
See what staying awake costs your battery
Tend is free to download. Pro is $1.99 a month, $12.99 a year with a 7-day free trial, or $29.99 once.