How to Prevent Mac from Sleeping When the Display Is Off on Power Adapter

When running long-term tasks such as local file backups, video rendering, large network downloads, or remote SSH sessions on a Mac, you may want your screen to switch off after a period of inactivity to save energy and protect your monitor. However, by default, macOS often transitions the entire system into deep sleep shortly after the display powers down, halting active background jobs.

In macOS Sonoma and Sequoia, Apple provides a dedicated power management toggle designed specifically for when your Mac is connected to mains electricity. Here is how to configure your Mac so that the display sleeps without suspending your applications, processes, and network connectivity.

Configuring macOS Displays Settings

This setting is housed within the Displays preference pane inside macOS System Settings:

  1. Click the Apple menu () in the top-left corner of the menu bar and select System Settings.
  2. In the left sidebar, scroll down and click Displays.
  3. At the bottom of the Displays settings panel, click the Advanced button.
  4. In the modal sheet that appears, locate the section labelled Battery & Energy.
  5. Toggle ON the switch labelled Prevent automatic sleeping on power adapter when the display is off.
  6. Click Done to save your configuration.

With this toggle enabled, you can safely allow your display to turn off after 5, 10, or 15 minutes of inactivity while knowing that all background terminal processes, server daemons, file downloads, and rendering pipelines will continue executing uninterrupted at full speed.

Setting Your Display Turn-Off Timer in Lock Screen Settings

To control exactly how quickly your screen turns off when you walk away from your desk, adjust your Lock Screen preferences:

  1. In System Settings, select Lock Screen from the left sidebar.
  2. Find the setting labelled Turn display off on power adapter when inactive.
  3. Click the dropdown menu and select your preferred duration (e.g., 10 minutes or 15 minutes).
  4. Ensure you keep the display turn-off time shorter than your intended workflow duration so the screen powers down while your Mac continues working.

Verifying Power Assertions via Terminal (pmset)

If you want to verify that your Mac is actively respecting the prevent-sleep assertion from the command line, you can inspect macOS power assertions using the built-in pmset utility:

  1. Open Terminal via Spotlight (Command + Space and type Terminal).
  2. Execute the following command:
pmset -g assertions

Look through the output under the Listed by owning process: header. When your Mac is actively executing background workflows or enforcing power adapter wakefulness, you will see assertions such as PreventUserIdleSystemSleep or PreventSystemSleep marked with a value of 1, accompanied by the name of the owning application (such as backupd, coreaudiod, or powerd).

Using the Built-In caffeinate Command for Temporary Tasks

If you only need to keep your Mac awake for a single specific task without permanently changing system-wide energy settings, use the native caffeinate command:

  • To keep the system awake while a specific terminal script or build command runs, prepend caffeinate -i:
    caffeinate -i ./long_render_script.sh
    Once the script finishes execution, caffeinate exits automatically and normal sleep policies resume immediately.
  • To keep the system awake for an arbitrary number of seconds (for instance, two hours / 7200 seconds):
    caffeinate -s -t 7200 &

Configuring display sleep independently of system sleep gives you the optimal balance between hardware conservation and uninterrupted processing power on macOS.

Get the best tech tips delivered straight to your inbox.

Join thousands of readers mastering Apple, Google, Microsoft, and Linux.