Sleep settings

How to keep a Mac awake

You keep a Mac awake by changing Lock Screen and Battery or Energy sleep settings, running the caffeinate command, or starting a timer from a menu bar app. Display sleep and system sleep are separate, and Apple documents different controls for battery and power adapter.

By the Napless team · Updated

Why does a Mac go to sleep?

A Mac goes to sleep after a stretch of inactivity you set in System Settings, and Apple treats turning the display off as a separate control from keeping the Mac itself from sleeping once the display is already off.

Apple’s sleep and wake guide puts the inactivity timers in Lock Screen. The two pop-up menus are “Turn display off on battery when inactive” and “Turn display off on power adapter when inactive.” You pick an option for each, so the battery timeout and the adapter timeout can differ.

Those Lock Screen labels talk about the display. Apple’s Lock Screen settings describe the same menus as how long the Mac can sit idle before the screen saver starts. The sleep guide uses those same menus when it tells you how to set the Mac to go to sleep after inactivity. In practice you are setting how long idle lasts before the screen goes dark. Whether the rest of the Mac stays on after that is a different switch.

On a laptop running macOS Sonoma 14 or later, that switch lives under Battery. Apple’s current sleep page and the Sonoma 14 and Sequoia 15 versions all name it “Prevent automatic sleeping on power adapter when the display is off.” Turn it on and the display can go off while the Mac stays awake on adapter power. On a desktop, the matching control is “Prevent automatic sleeping when the display is off,” under Energy on Sequoia 15 and later, and under Energy Saver on Sonoma 14 and Ventura 13.

The caffeinate man page on macOS draws the same line in command flags. -d prevents the display from sleeping. -i prevents the system from idle sleeping. -s prevents system sleep, and that assertion is valid only on AC power. Display sleep, idle sleep, and system sleep are three different holds.

Sharing services and Spotlight indexing can also hold a Mac awake, as can connected hardware. Apple’s unexpected sleep page lists sharing services, background processes you can see in Activity Monitor, apps that access a disk (Music reading tracks, DVD Player reading a disc), Spotlight indexing, and malfunctioning USB or Thunderbolt devices. Keyboard presses and mouse or trackpad clicks wake the Mac. man pmset on macOS adds that processes can override power-management settings with I/O Kit power assertions, and that pmset -g assertions lists those processes.

Apple’s Sequoia 15 and current sleep pages also note that delaying, preventing, or allowing disruption of sleep may increase power consumption. Some options are missing on some Macs.

How do you change sleep settings in System Settings?

Change display-off timers in Lock Screen, then use Battery Options on a laptop with macOS 14 or later, advanced Displays settings on macOS 13, or Energy settings on a desktop (Energy Saver on macOS 13 and 14).

Apple’s Ventura 13, Sonoma 14, Sequoia 15, and current sleep pages all start in the same place.

Lock Screen display-off timers (macOS 13 and later)

  1. Choose Apple menu > System Settings.
  2. Click Lock Screen in the sidebar.
  3. Open “Turn display off on battery when inactive” and choose an option.
  4. Open “Turn display off on power adapter when inactive” and choose an option.

Use the battery menu when the Mac is on battery, and the power-adapter menu when it is plugged in. Apple’s pages say “choose an option” and leave the minute values out of those articles.

Prevent sleep when the display is off (laptop, macOS 14 and later)

On Sonoma 14, Sequoia 15, and current macOS:

  1. Choose Apple menu > System Settings.
  2. Click Battery in the sidebar.
  3. Click Options.
  4. Turn on “Prevent automatic sleeping on power adapter when the display is off.”

The checkbox applies while the laptop is on adapter power with its display off.

Prevent sleep when the display is off (laptop, macOS 13)

The Ventura 13 sleep page does not list that Battery Options checkbox. It points at advanced Displays settings. The Displays table’s Advanced row describes Battery & Energy as: slightly dim the display while using battery power, or prevent the Mac from sleeping when it is plugged in and its display is off.

The Ventura 13 unexpected-sleep page names the control “Prevent automatic sleeping on power adapter when the display is off” and places it in Displays settings. On later versions, the current unexpected-sleep page places that same name in Battery settings.

Desktop Energy and Energy Saver

On a desktop, Sequoia 15 and current macOS use System Settings > Energy. Turn on “Prevent automatic sleeping when the display is off.”

On Sonoma 14, the sidebar item is Energy Saver and the checkbox has the same name. The Ventura 13 sleep guide also names Energy Saver, but directs you to advanced Displays settings to prevent automatic sleep. Use its linked Displays instructions for the plugged-in, display-off control.

These are standing preferences. They stay until you change them, including after a download finishes. If a process holds a power assertion, man pmset on macOS says that process can override the preference. Apple’s unexpected-sleep page is the place to start when sleep still does not match the menus.

How do you keep a Mac awake from Terminal with caffeinate?

The caffeinate command, which ships at /usr/bin/caffeinate on macOS, creates power assertions that prevent idle sleep, display sleep, or both, for a timeout, for the life of another command, or until you stop it.

man caffeinate on macOS is the source for every flag below. If you pass no assertion flags, caffeinate prevents idle sleep. If you name a utility, the assertions last while that utility runs. If you do not name a utility, they last until caffeinate itself exits.

Flag What the man page says
-d Prevent the display from sleeping
-i Prevent the system from idle sleeping
-m Prevent the disk from idle sleeping
-s Prevent the system from sleeping; valid only on AC power
-u Declare the user active; turns the display on if it is off; default timeout 5 seconds unless you pass -t
-t Timeout in seconds; ignored when you invoke a utility
-w Wait for a process ID to exit, then drop the assertion; ignored with a utility

The man page example holds idle sleep for a build:

caffeinate -i make

caffeinate forks, runs make, and keeps the idle-sleep assertion until make exits.

For a timed hold with no extra command, pass seconds to -t. 3600 seconds is one hour:

caffeinate -i -t 3600

To keep the display on as well as the Mac, add -d:

caffeinate -d -i

That form runs until you stop it (Control-C in that Terminal, or quitting the process). -t still works if you want a deadline.

The full flag list, including -w and wrapping other jobs, is on the caffeinate command page. caffeinate ships with macOS and needs Terminal. The caffeinate command does not print a countdown in Terminal. Use pmset -g assertions to inspect its hold; the command has no menu bar warning when a hold ends.

How do you keep a Mac awake with a menu bar app?

Napless keeps a Mac awake with a Keep Awake For or Keep Awake Until timer started from the menu bar. Napless shows time left in the menu bar. Other keep-awake apps exist; the app comparison lines those apps up against caffeinate and System Settings.

Napless requires macOS 13 or later, on Apple silicon and Intel. It is signed and notarized by Apple. Download it for the timers below. System Settings and caffeinate still work if you never install it.

From the Napless menu, use Keep Awake For to choose a duration or Keep Awake Until to choose an end time. Napless shows the remaining time in the menu bar. Napless Help documents Add 15 Minutes and Restart the Timer When I Use My Mac: the latter restarts a duration timer from your last activity, while Keep Awake Until keeps its original end time.

Allow Display to Sleep is in the Napless menu and in Settings > General (Napless help). Leave it on if you want the screen dark while the Mac stays awake. That is the same split Apple draws with “Prevent automatic sleeping on power adapter when the display is off.”

Free Napless also stops keep-awake when the Mac gets too hot (on by default) and at a battery floor you pick. Heat protection ends a timed session when thermal state is serious or critical; restart the timer yourself once the Mac has cooled. On macOS 26 and later there is a Control Center control. Honest status, Check Health, and napless doctor report whether macOS is actually holding the Mac awake.

Napless Pro is coming soon at $7.99 one time for up to 3 Macs. It is not for sale today. Pro adds automatic keep-awake (downloads, calls and audio, chosen apps, desk, power, Wi-Fi, schedule), watches, Shortcuts/Siri/Focus, agent mode, Keep Chat Apps Active, and a Time Machine trigger. Details live in Napless help and on the Pro page.

How do you keep a Mac awake for a download, a call, a build, or an AI agent?

For a download, a call, a build, or an AI agent run, wrap the work in caffeinate or start a Napless timer for longer than the job. Napless Pro, coming soon, adds automatic triggers and watches for those jobs.

A long download can outlast the Lock Screen idle. Until Pro ships, pick Keep Awake For a duration that outlasts the file, Keep Awake Until a clock time, or run caffeinate -i -t with enough seconds. Pro’s planned automatic keep-awake includes downloads, and its watches include waiting for a file to finish (Free and Pro summary).

For a call, choose a timer that covers the meeting. Pro’s planned automatic keep-awake covers calls and audio (Free and Pro summary). Choose -i if you want idle system sleep blocked but can let the screen turn off, or add -d for the display. Until then, a timed session or caffeinate -d -i for the length of the meeting keeps the Mac (and, with -d, the display) from idle sleep. Slack and Teams use activity to set availability; see how Slack and Teams set away on a Mac.

A build is the case caffeinate already documents:

caffeinate -i make

Swap make for your compiler, test runner, or packager. Pro, when it ships, has napless run -- make release as a watch that lasts until that command exits (Napless help).

For an AI coding agent, choose a hold that covers the work you want to finish. Napless Pro agent mode has hooks only for Claude Code, Codex, Grok, Cursor, and Gemini CLI (Napless Help).

Other agents use napless run -- for a CLI or “keep awake while a chosen app is open” for a desktop app. Both of those are Pro, and Pro is coming soon. The agent page is keep a Mac awake for AI coding agents. Until Pro ships, wrap the CLI in caffeinate -i or start a Napless timer.

Agent Mode limits differ by tool: Claude Code, Codex, and Grok holds stop at most 10 minutes after the last prompt, even if a turn is still running. Cursor holds last at most 60 minutes after the last prompt. Gemini CLI stays awake while its session is open. Plan around those limits when deciding whether a timer or command wrapper fits the job.

Can a MacBook stay awake with the lid closed?

A MacBook can stay awake with the lid closed in a supported external-display setup, although closing the display normally puts the laptop to sleep, according to Apple’s sleep and wake page.

Apple documents one closed-lid setup in current Support: dual external displays on MacBook Air and MacBook Pro with M3 chip. That article requires an external keyboard and mouse or trackpad; macOS Sonoma 14.3 or later on MacBook Air, or 14.6 or later on MacBook Pro; display power via USB-C or a power adapter with a USB-C to MagSafe Cable; the Mac on power (the display can supply that power); then close the lid after the first display is connected. The article is a dual-monitor procedure for those M3 models.

Napless Keep Awake With Lid Closed is coming in an update. Napless help says it will stop on heat, at a battery floor, and after a time limit.

For more closed-lid setups, see using a MacBook with the lid closed.

How do you check what is keeping a Mac awake?

pmset -g assertions lists I/O Kit power assertions that can prevent system sleep or display sleep, and Apple’s unexpected-sleep page adds Activity Monitor when a process is holding the Mac up.

man pmset on macOS says processes may dynamically override power-management settings with those assertions, and that pmset -g and pmset -g assertions name the processes. The same manual documents displaysleep and sleep as separate timers (minutes, or 0 to disable).

pmset -g assertions

Look for names such as PreventUserIdleSystemSleep and PreventUserIdleDisplaySleep, and for the process next to each one. caffeinate shows up there as “caffeinate command-line tool” when it is running.

Apple’s unexpected-sleep page is the GUI path: Activity Monitor > CPU, Sharing settings, Wake for network access, Spotlight indexing, and USB or Thunderbolt devices.

If Napless is running, Check Health (from the menu or Settings > General) and napless doctor report whether keep-awake is actually held. An orange triangle means a check failed or the Mac slept while Napless was keeping it awake (Napless help).

The longer walkthrough is what is keeping a Mac awake.

Which keep-awake method should you use?

Use System Settings for a standing plugged-in preference, caffeinate for a Terminal job, and a menu bar timer when you want a duration you can start from the menu.

Method How long it lasts Needs Terminal Stops automatically Cost
System Settings Lock Screen timers Until the idle you chose, then the display goes off No The Mac still follows that idle Included with macOS
Prevent automatic sleeping when the display is off Until you turn the checkbox off No No Included with macOS
caffeinate -i -t (seconds) The timeout you pass Yes Yes, when the timeout ends Included with macOS
caffeinate wrapping a command While that command runs Yes Yes, when the command exits Included with macOS
Napless Keep Awake For / Until The duration or clock time you pick, or indefinitely No Yes for timed sessions; an indefinite hold can also end for safety protection Free
Napless Pro automatic keep-awake and watches While the download, call, app, schedule, or command applies No (napless run is optional) Yes, when that work ends $7.99 one time, up to 3 Macs, coming soon

Apple’s Sequoia 15 and current sleep pages still apply: delaying or preventing sleep may increase power consumption.

For flag-by-flag caffeinate, see the caffeinate command. For app-by-app differences, see keep-awake apps compared.

Questions

Does preventing Mac sleep use more power?

Apple's Sequoia 15 and current sleep pages say delaying, preventing, or allowing disruption of sleep may increase power consumption. Some options also depend on the Mac.

Does the caffeinate command keep the display on?

The -d flag creates an assertion that prevents the display from sleeping. With no flags, caffeinate prevents idle sleep only. The -u flag declares the user active, turns the display on if it is off, and lasts 5 seconds unless you pass -t.

Can you buy Napless Pro today?

Napless Pro is coming soon at $7.99 one time for up to 3 Macs. Napless timers, time left in the menu bar, the global shortcut, Control Center on macOS 26 and later, honest status, and heat and battery stops are free.

Does keeping a Mac awake keep Slack or Teams active?

Keeping a Mac awake does not guarantee active status in Slack or Teams. Both apps use activity to set availability; the Slack and Teams away guide explains those rules.