MainspringGuides › Stop your Mac from sleeping
macOS Guide

How to stop your Mac from going to sleep

Updated 2026 · 5 min read

Your Mac sleeping mid-task — during a long download, a video render, or a remote SSH session — is more than annoying. It can break things. Here is how to take full control of display sleep and system sleep on macOS, whether you prefer clicking through System Settings, typing a Terminal command, or just flipping a toggle.

Understanding the two types of sleep

macOS has two separate sleep settings that often get confused. Display sleep turns off the screen after inactivity — the fans keep running and your download keeps going, but you need to move the mouse or tap a key to wake the display. System sleep is deeper: the whole machine suspends, network connections drop, and anything waiting on CPU or network stalls until you wake it.

For most "keep my Mac awake" situations, you need to disable system sleep. For presentation or screen-share scenarios, you usually want to disable display sleep too.

Option 1 — System Settings sliders

The GUI approach works well for a permanent or semi-permanent change.

  1. Open System Settings (the gear icon in your Dock or Apple menu).
  2. On a laptop, go to Battery. You'll see separate sub-sections for when you're on power adapter and on battery. Click each one to reveal the sleep sliders.
  3. On a desktop Mac (Mac mini, iMac, Mac Pro, Mac Studio), go to Lock Screen. You'll find Turn display off after and, on some models, a system sleep option.
  4. Drag the "Turn display off after" slider to Never.
  5. If there is a "Prevent automatic sleeping on power adapter when the display is off" checkbox, enable it.

On macOS Ventura (13) and later the Battery pane was reorganised — look for an Options button inside the Battery pane that reveals Power Nap and sleeping settings if you don't see them at first glance.

Option 2 — pmset in Terminal

pmset is the macOS power management command-line tool. It lets you set sleep values precisely and script them if needed. All pmset changes that affect system-wide settings require sudo.

Check your current settings first

# see all current power management values
pmset -g

Look for sleep (system sleep, in minutes) and displaysleep (display sleep, in minutes). A value of 0 means disabled.

Disable system sleep

# prevent the system from sleeping (0 = never)
sudo pmset -a sleep 0

# to restore the default (10 minutes on battery, adjust to taste)
sudo pmset -a sleep 10

Disable display sleep

# prevent the display from sleeping
sudo pmset -a displaysleep 0

# to restore (5 minutes is a common default)
sudo pmset -a displaysleep 5

Scope your changes

The -a flag applies the setting to all power sources (AC adapter and battery). If you only want to change the setting for one source, use -c (charger/AC) or -b (battery) instead:

# disable sleep only when plugged in, leave battery sleep unchanged
sudo pmset -c sleep 0

Verify the change took effect

# confirm sleep and displaysleep are now 0
pmset -g | grep -E "^( sleep| displaysleep)"

When to undo

These settings persist across restarts — macOS remembers them until you change them back. If you disable sleep for a one-off task, remember to restore the defaults when you're done. A Mac that never sleeps will drain its battery noticeably faster when unplugged, and running the display indefinitely adds some wear. The restore commands above are worth bookmarking.

Sleep controls without Terminal

Mainspring exposes macOS sleep settings as clearly labelled, reversible toggles — no Terminal window, no sudo, no commands to remember. Flip sleep off for a long task, flip it back when you're done. Every change is one click to undo, and Mainspring shows you exactly what each toggle does before you apply it.

Try Mainspring free →

Signed & notarized by Apple · 1-day free trial · $29 once

What about the screensaver?

The screensaver is separate from display sleep. If your screen goes dark but the screensaver doesn't launch, you've hit display sleep. If a pattern starts playing but the Mac itself stays awake, that's the screensaver. To control the screensaver delay, go to System Settings > Lock Screen and adjust Start Screen Saver after. Setting it to Never disables it entirely.

Lid-closed sleep on a MacBook

Closing a MacBook lid puts it to sleep regardless of your pmset settings — that is handled by a different mechanism. If you need the Mac to keep running with the lid closed (clamshell mode), you need to connect it to an external display, power source, and a keyboard or mouse. Once all three are connected, closing the lid switches to clamshell mode and the Mac stays awake. See our guide on keeping your Mac awake with the lid closed for the full setup.