Mac Field Guide

SettingsHow-to

How to keep your Mac awake: settings, Terminal and a menu bar switch

Applies to macOS 14, 15, 26 and 27Reviewed 16 November 20263 min read

Short answer

To keep a Mac awake for a while, run caffeinate -d in Terminal and leave the window open, or use a menu bar switch such as Cruise Control. To stop it sleeping for good, set System Settings › Lock Screen › Turn display off when inactive to Never, then turn on Prevent automatic sleeping when the display is off (in Battery › Options on a MacBook, or Energy on a desktop Mac).

On this page
  1. Keep it awake for a while with Terminal
  2. Keep it awake from the menu bar
  3. Stop a MacBook from sleeping on its own
  4. Stop a desktop Mac from sleeping
  5. Stop the Mac sleeping during a download
  6. What keeping it awake doesn't stop
  7. Check what's keeping your Mac awake
  8. Apps that keep a Mac awake
  9. Sources and further reading

Keep it awake for a while with Terminal

macOS has a built-in command for this, caffeinate. It keeps the Mac awake for as long as it runs.

  1. Open Terminal (in Applications › Utilities, or press Command-Space and type Terminal).
  2. Type caffeinate -d and press Return. The Mac and its screen now stay awake.
  3. Leave the Terminal window open. To let the Mac sleep again, press Control-C or close the window.

A few useful variations:

CommandWhat it does
caffeinate -dKeeps the Mac and the screen awake.
caffeinate -iKeeps the Mac awake but lets the screen turn off. Good for downloads and backups.
caffeinate -d -t 3600Stays on for 3600 seconds (one hour), then stops on its own.
caffeinate -i some-commandKeeps the Mac awake until that command finishes, for example a long script or curl download.
caffeinate -i -w 1234Keeps the Mac awake until the process with ID 1234 quits. Find the ID in Activity Monitor.

Keep it awake from the menu bar

If you'd rather not keep a Terminal window around, a menu bar app does the same thing behind a click. They use the same mechanism as caffeinate, and macOS forgets the request as soon as the app quits.

Stop a MacBook from sleeping on its own

A MacBook sleeps after its display turns off. Keep the display on longer, or let the Mac stay awake while it's off:

  1. Open System Settings › Lock Screen.
  2. Set Turn display off on power adapter when inactive to Never, or to a longer time. Do the same for the battery setting if you want.
  3. To keep the Mac working with the screen off instead, open System Settings › Battery, click Options, and turn on Prevent automatic sleeping on power adapter when the display is off.

This only applies while the charger is connected. On battery, the Mac still sleeps once the display turns off, and it always sleeps when you close the lid. For that, see keeping a MacBook awake with the lid closed.

Stop a desktop Mac from sleeping

On an iMac, Mac mini, Mac Studio or Mac Pro:

  1. Open System Settings › Energy (called Energy Saver on older versions).
  2. Turn on Prevent automatic sleeping when the display is off.
  3. To keep the screen on too, open System Settings › Lock Screen and set Turn display off when inactive to Never.

Stop the Mac sleeping during a download

When a Mac goes to sleep, most downloads pause, and some don't pick up again when it wakes. For one big download, you don't need to change any settings:

  1. Plug in the charger and leave the lid open.
  2. Run caffeinate -i in Terminal, or turn on a keep-awake app. The screen can still turn off, and the download keeps going.
  3. When the download is done, press Control-C in Terminal or switch the app off, so the Mac sleeps as usual again.

For a download from Terminal, put caffeinate -i in front of the command, such as caffeinate -i curl -O https://example.com/big-file.zip, and the Mac stays awake exactly until it's done. If a macOS update won't finish downloading, see fixes for macOS updates that won't download.

What keeping it awake doesn't stop

  • Closing the lid. A MacBook sleeps when you close it, unless it's in clamshell mode with an external display. See the lid-closed guide.
  • Sleep from the Apple menu, or pressing the power button.
  • A nearly empty battery. macOS puts the Mac to sleep to protect your work.

Check what's keeping your Mac awake

If your Mac won't sleep, or sleeps when it shouldn't, run pmset -g assertions in Terminal. Lines with PreventUserIdleSystemSleep or PreventUserIdleDisplaySleep set to 1 mean something is holding the Mac awake, and the list below them names the app, such as a video player, a call or caffeinate itself.

Apps that keep a Mac awake

They all do what caffeinate does, behind a switch in the menu bar. Pick the one with the options you need.

AppWhat it doesPrice
Cruise Control Made by usA keep-awake switch with a timer, Let the screen dim, and lid-closed awakeFree
AmphetamineKeep-awake sessions with triggers for apps, downloads, displays and moreFree
KeepingYouAwakeA minimal menu bar toggle built on caffeinateFree, open source

Sources and further reading

Applies tomacOS 27TahoeSequoiaSonoma

Reader tips

    No tips yet. If something else worked for you, or a step looks different on your Mac, add it here.

    Add a tip

    No links or email addresses. Tips are checked before they show. How we handle tips

    Keep reading