Blog · Mac guide

How to keep your Mac awake (and let it sleep again)

Your Mac nods off at the worst moments: halfway through a download, mid-render, in the middle of your slides. Here’s how to keep it up, and how to let it rest afterwards.

October 14, 20264 min read
ZZZ1:24

The settings

On a MacBook, open System Settings › Battery › Options and turn on Prevent automatic sleeping on power adapter when the display is off. On a desktop Mac, the same switch is in System Settings › Energy. How soon the display turns off is set in System Settings › Lock Screen.

The Terminal way: caffeinate

macOS has a command for exactly this. In Terminal:

  • caffeinate keeps your Mac awake until you press Control-C.
  • caffeinate -d keeps the display on as well.
  • caffeinate -t 3600 stops after an hour (the number is in seconds).
  • caffeinate -w 1234 waits until the process with that number finishes: handy for a long export.
  • caffeinate -s stops the whole system sleeping, but only while it’s plugged in.

Press Control-C or close the Terminal window and your Mac goes back to its usual habits.

With the lid closed

A MacBook keeps working with its lid closed only when it’s plugged in and connected to an external display, keyboard and mouse or trackpad. On a Mac with Apple silicon, approve those accessories first, under System Settings › Privacy & Security › Accessories. Without a display, closing the lid puts it to sleep.

Or one click

SideDock’s Keep Awake switch stops your Mac sleeping until you turn it off, or for a set time, and while it’s on, the notch shows how long is left. It’s also in the Controls tile, next to Dark Mode and Mic Mute.

Try SideDock free for 7 days

Everything unlocked, no card, no account. Pay once if it stays.

Download