How to stop a Mac from going to sleep

macOS puts your Mac to sleep after a period of inactivity, and every Mac ships with several ways to hold that back. This guide goes through each free, built-in way in turn: the sleep settings on laptops and desktops, the display-off timing, the caffeinate command and closed-lid use. Each section gives the exact steps and says what the method can’t do, and the end covers what our app Wake adds.

In System Settings, on a laptop

On a MacBook this switch lives in Battery settings, and it suits a laptop that spends its working life plugged in. Apple lists it under Additional Options and describes it as “Prevent your Mac from sleeping when it’s plugged in and its display is off.”

  1. Choose Apple menu > System Settings, then click Battery in the sidebar. (You may need to scroll down.)
  2. Click Options.
  3. Turn on “Prevent automatic sleeping on power adapter when the display is off.”

The Battery path and the option name are the same on macOS Sonoma 14, Sequoia 15, Tahoe 26 and macOS 27, the versions in Apple’s Mac User Guide as of 13 November 2026, which defaults to macOS 27 Golden Gate; the Sonoma 14 page words the middle step as “Click Options on the right”. macOS Ventura 13 is the exception: its Battery steps do not list this option. That version of the page says “You can also keep your Mac from going to sleep automatically in the advanced Displays settings,” and the Ventura Displays page lists it under Advanced as “Battery & Energy: Slightly dim the display while using battery power, or prevent your Mac from sleeping when it’s plugged in and its display is off.”

By its name and Apple’s description, the option applies only while the Mac is plugged in to a power adapter, and it is an on/off switch; Apple’s pages describe no timer for it. Apple notes that “Some of the options may not be available, depending on your Mac,” and warns that “delaying, preventing, or allowing disruption of sleep may increase power consumption.”

In System Settings, on a desktop

On a desktop Mac the equivalent switch sits in Energy settings. Apple describes it as “Prevent your Mac from going to sleep automatically when its display is off.”

  1. Choose Apple menu > System Settings, then click Energy in the sidebar. (You may need to scroll down.) On macOS Sonoma 14 the sidebar item is Energy Saver.
  2. Turn on “Prevent automatic sleeping when the display is off.”

The option name is the same from macOS Sonoma 14 through macOS 27; the only difference is the sidebar label, which is Energy Saver on macOS Sonoma 14 and Energy on macOS Sequoia 15, Tahoe 26 and macOS 27. Like the laptop switch, it is an on/off switch, and Apple’s pages describe no timer for it.

Set when the display turns off

Lock Screen settings control how long your Mac waits before the display turns off. Apple lists the two pop-up menus under the heading “Set your Mac to go to sleep after inactivity”.

  1. Choose Apple menu > System Settings, then click Lock Screen in the sidebar. (You may need to scroll down.)
  2. Click the pop-up menu next to “Turn display off on battery when inactive,” then choose an option.
  3. Click the pop-up menu next to “Turn display off on power adapter when inactive,” then choose an option.

The same steps and option names appear in the macOS Tahoe 26, Sequoia 15 and Sonoma 14 versions of Apple’s page. Apple’s pages do not list the durations the pop-up menus offer, so open the menus on your Mac to see what they provide.

The caffeinate command in Terminal

caffeinate is built into macOS at /usr/bin/caffeinate, and its man page describes it as “prevent the system from sleeping on behalf of a utility”. It suits one-off jobs, because its effect lasts only while caffeinate, or a command you give it, is running.

  1. Open Terminal.
  2. Run `caffeinate` to prevent idle sleep until caffeinate exits.
  3. Run `caffeinate -d` to also prevent the display from sleeping.
  4. Run `caffeinate -t 3600` to hold the assertion for 3600 seconds (the timeout is in seconds).
  5. Run `caffeinate -i make` (any command in place of make) to prevent idle sleep for as long as that command is running.
  6. Run `caffeinate -w <pid>` to hold the assertion until the process with that pid exits.

If no assertion flags are specified, caffeinate creates an assertion to prevent idle sleep, which is what the plain command does. The man page also documents -m, which prevents the disk from idle sleeping, and -u, which declares that the user is active, turns the display on if it is off, and defaults to a 5 second timeout unless -t is given.

The -s flag, which prevents the system from sleeping, is valid only when the Mac is running on AC power. The -t timeout is not used when caffeinate is given a utility to run, and -w is ignored in that case. The man page says nothing about keeping a laptop awake with its lid closed.

With the lid closed

A Mac laptop can keep working with its lid shut once the right things are attached. Apple’s MacBook Pro guide says “When you have an external display and accessories (like a keyboard and mouse) connected to your MacBook Pro, you can keep working even when the lid is closed,” and the MacBook Air guide says the same: after you connect a display, “you can close the lid and continue to use it with connected accessories.”

  1. Connect the Mac laptop to power.
  2. Connect an external keyboard and mouse or trackpad.
  3. Connect an external display.
  4. On a Mac laptop with Apple silicon, allow the display, mouse and keyboard to connect if asked.
  5. Close the lid.

Apple documents closed-lid use only with power, an external display, and an external keyboard and mouse or trackpad connected. On Mac laptops with Apple silicon, you first need to allow an external display, a mouse, and a keyboard to connect; then you can use your Mac with the lid closed, or with a docking station in which you place your Mac with the lid closed.

For two external displays on a MacBook Air or MacBook Pro with M3 chip, Apple 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, and display power via USB-C or a power adapter. “If the external display provides power to the Mac, a separate power adapter isn’t needed.”

With Wake

Wake is our menu bar app for this job. Click the icon to keep your Mac awake until you turn it off, or for 15 minutes, 30 minutes, 1, 2, 4 or 8 hours, and Option-click the icon to switch it on and off straight away. The menu bar can show the time left.

While it is on, Wake holds a power management assertion (IOPMAssertionCreateWithName), the same mechanism caffeinate uses: PreventUserIdleDisplaySleep, or PreventUserIdleSystemSleep when the Let Display Sleep setting is on. If Wake quits or crashes, macOS drops the assertion by itself, and `pmset -g assertions` lists it as “Wake is keeping this Mac awake”. The settings let the display sleep, turn Wake off below 20% battery (on by default, and only on Macs with a battery), show the time left in the menu bar, turn on when Wake opens, and open at login.

Closing a MacBook’s lid still sleeps it unless clamshell mode applies, with an external display, power and a keyboard; Wake doesn’t change that. Its longest timed session is 8 hours, and beyond that it is on until you turn it off. Wake asks for no permissions, collects no analytics, and goes online only to activate the licence and check for updates. It requires macOS 14 Sonoma or later, on Apple silicon or Intel. It costs US$9 once, tax included; one licence covers up to 3 of your Macs, every future update is included, and there is no subscription and no account. It is free for 7 days with no card, and refunds are available within 30 days.

Try Wake free for 7 days.

Then $9 once, for up to 3 of your Macs. No subscription and no account.

Requires macOS 14 Sonoma or later, Apple silicon or Intel.

Sources

Checked on 13 November 2026.