Keep your Mac awake: settings and caffeinate

macOS can keep a Mac awake with its own settings or with caffeinate, a command that is already installed. Pick the method that matches how long you need it and whether the display must stay on.

Last reviewed: November 2, 2026

Display sleep vs system sleep on a Mac

When the display sleeps, the screen turns off but apps keep running. When the system sleeps, the Mac pauses work such as downloads and exports. Settings and tools let you prevent one, the other, or both.

Change the settings in System Settings

  1. Open System Settings > Lock Screen. Adjust Turn display off on battery when inactive and Turn display off on power adapter when inactive[1].
  2. On a MacBook, open System Settings > Battery > Options and turn on Prevent automatic sleeping on power adapter when the display is off[2].
  3. On a desktop Mac, open System Settings > Energy and turn on Prevent automatic sleeping when the display is off[2].

Labels are from Apple's current macOS guide; older versions use similar wording under Energy Saver. On a company Mac some options can be locked by device management.

caffeinate: keep a Mac awake from Terminal

Open Terminal and type a command. It works until you press Control-C or the timer ends. No installation and no admin password are needed for the common uses.

caffeinate -d

keeps the display on until you stop it.

caffeinate -dims -t 7200

keeps display and system awake for 7,200 seconds (two hours). The main options[3]:

OptionEffect
-dPrevent the display from sleeping
-iPrevent the system from idle sleeping
-mPrevent the disk from idle sleeping
-sPrevent system sleep; only on AC power
-uDeclare the user active; turns the display on, with a short default timeout
-t secondsStop after this many seconds
-w PIDStay awake until the process with that ID exits

To keep a Mac awake exactly as long as a job takes, run the job through caffeinate, for example caffeinate -i ./long-script.sh. The summary of options comes from a copy of the manual page; type man caffeinate on your Mac for the authoritative version.

Amphetamine, Caffeine and other menu bar apps

Menu bar apps give caffeinate-like controls with a click, schedules and triggers. They are convenient if you need it every day. If you only need it occasionally, or you cannot install apps on a work Mac, caffeinate or the browser keep-awake tool do the same basic job. The alternatives comparison covers the trade-offs.

With the lid closed

Closing a MacBook lid normally puts it to sleep. Apple's supported exception is closed-display mode with an external display: the Mac must be connected to power and use an external keyboard and mouse[4]. Keep-awake tools do not change that rule reliably, so plan long tasks with the lid open or in closed-display mode.

Why caffeinate does not keep Teams active

caffeinate prevents sleep; it does not type or move the mouse. Chat apps measure activity, so you can be shown as away while the screen is still on. The Teams guide and Slack guide explain the documented options. For downloads and renders, see preventing sleep during long tasks.

Frequently asked questions

How do I keep a Mac awake without an app?

Use caffeinate -d in Terminal, or change the Lock Screen and Battery settings. A browser tab with the keep-awake tool is another no-install option.

How do I keep a MacBook awake on battery?

Increase Turn display off on battery when inactive, or run caffeinate -d. The -s option only works on AC power.

How do I stop caffeinate?

Press Control-C in its Terminal window, close the window, or use -t so it ends by itself.

Sources

Official documentation consulted when writing this page. Menus and defaults change between versions, so check the current documentation for your version.

  1. Change Lock Screen settings on Mac — Apple Support
  2. Set sleep and wake settings for your Mac — Apple Support
  3. caffeinate (man page copy, unofficial) — SS64
  4. Use your Mac notebook computer in closed-display mode — Apple Support