Вернуться в блог
Guide

caffeinate on Mac: Keep Your Mac Awake From Terminal

caffeinate is the built-in macOS command that keeps a Mac awake. Run caffeinate -d to stop the display sleeping, -i to stop idle sleep, add -t for a time limit, and press Ctrl+C to stop. Every flag with examples, and why it does not keep Slack active.

Slack Green Team
September 23, 2026
September 23, 2026
5 min read
Share:
mac
terminal
remote work

caffeinate is a command built into macOS that keeps your Mac awake. Open Terminal and run caffeinate -d to stop the display from sleeping, or caffeinate with no flags to stop the system from idle sleep. It runs until you press Ctrl+C. Add -t 3600 to stop after an hour, or put a command after it, such as caffeinate -i ./backup.sh, to stay awake only while that command runs. It needs no admin password and no install.

It does not keep Slack active. Slack sets you away 10 minutes after your last input in the Slack window, whether the Mac is awake or not. caffeinate only stops the instant away you get when the Mac sleeps. To keep your dot green without the Mac, Slack Green keeps your presence active from its own servers during the working hours you set.

caffeinate: keep a Mac awake from Terminal, flags, timeouts, stop, Slack

caffeinate flags

caffeinate flags from the macOS man page, with examples

From man caffeinate:

FlagWhat it does
-dPrevents the display from sleeping
-iPrevents the system from idle sleeping (the default with no flags)
-mPrevents the disk from idle sleeping
-sPrevents the system from sleeping, only on AC power
-uDeclares that the user is active; turns the display on if it is off. Lasts 5 seconds unless you add -t
-t secondsDrops the assertion after that many seconds
-w PIDKeeps it until the process with that ID exits
commandKeeps it while the command runs

caffeinate -i vs -d

  • caffeinate -i keeps the computer running, but the display can still turn off. Use it for downloads, backups and builds.
  • caffeinate -d keeps the display on. Use it when you want the screen visible, or to stop the screen saver and the lock that follows it.
  • caffeinate -di does both. Flags combine, so caffeinate -dims sets four at once.
  • caffeinate examples

Больше никогда не показывать "отошёл" в Slack

Облачное решение. Без загрузок. Работает 24/7 даже при выключенном ноутбуке.

# Keep the display on until you press Ctrl+C
caffeinate -d

# Keep the Mac awake for two hours, then stop
caffeinate -di -t 7200

# Stay awake only while a command runs
caffeinate -i rsync -a ~/Projects /Volumes/Backup/

# Stay awake until another app quits (find its PID with pgrep)
caffeinate -i -w "$(pgrep -x Transmission)"

# Run it in the background and keep using the same Terminal window
caffeinate -d &

Check that it is working with pmset -g assertions. The output lists PreventUserIdleDisplaySleep or PreventUserIdleSystemSleep held by caffeinate.

How to stop caffeinate

  • • If it runs in the Terminal window, press Ctrl+C.
  • • If you started it in the background or forgot where, run killall caffeinate.
  • • If you used -t, it stops on its own when the time is up.
  • caffeinate and the MacBook lid

    Closing the lid puts a MacBook to sleep even with caffeinate running, unless the Mac is on power with an external display, keyboard and mouse attached. caffeinate keeps an open Mac awake; it does not replace clamshell mode. Lid-closed options for Mac and Windows are in keep a laptop awake with the lid closed.

    Does caffeinate keep Slack active?

    Больше никогда не показывать "отошёл" в Slack

    Облачное решение. Без загрузок. Работает 24/7 даже при выключенном ноутбуке.

    Does caffeinate keep Slack active: what it fixes and what it does not

    No. We tested the same thing with the Caffeine app: Slack stayed green until minute 10, then went away with the screen still on. The full test is in does Caffeine keep Slack active.

    caffeinate removes one trigger, the Mac sleeping or locking, which sets you away at once. Slack's idle timer counts only input inside the Slack window, and caffeinate creates none. caffeinate -u wakes the display for a few seconds, which is still not input in Slack. The Mac-specific rules are in keep Slack active on Mac, and every method is compared in how to keep Slack active.

    If the goal is a green dot, not an awake Mac, Slack Green keeps it active on your schedule from a server, with the lid closed. For the same question about the Amphetamine app, see does Amphetamine keep Slack active.

    caffeinate on a work Mac

    caffeinate is built in and needs no admin rights, so it works on most managed Macs. A screen lock enforced by your company through MDM still applies. Lock Screen settings that stop locks for good are in keep a Mac screen from locking. For Windows and Linux equivalents, see keep a work computer awake without admin rights.

    FAQ

    What does caffeinate do on a Mac?

    It creates power assertions that stop the display, the system or the disk from sleeping, until you stop it or its time limit ends.

    How do I keep my Mac awake from Terminal?

    Run caffeinate -d for the display, or caffeinate -di -t 3600 for display and system for one hour.

    How do I stop caffeinate?

    Press Ctrl+C in its Terminal window, or run killall caffeinate.

    Does caffeinate need sudo?

    No. It runs as your user.

    Does caffeinate keep Teams active?

    No. Teams sets you away after 5 minutes of inactivity in Teams, whether the Mac is awake or not.

    Always Active

    Хватит Двигать Мышкой.

    Сотни удалённых работников больше не беспокоятся о статусе Slack. Настройте один раз, оставайтесь зелёными навсегда.

    Related Articles

    Guide

    Slack Workflow Builder Examples: 12 Workflows to Copy, With Triggers and Steps

    Twelve Slack Workflow Builder examples with the exact trigger and steps for each: daily standups, channel welcomes, time-off approvals, help desk requests, emoji escalations, keyword routing, incidents, list updates and webhooks from other tools. Plus where Workflow Builder lives, what it costs and how branches work.

    Slack Green Team5 min read
    Guide

    Slack Timer: How to Set a Countdown, Pomodoro or Focus Timer in Slack

    Slack has no built-in timer, but four built-in tools act like one: /remind me to ... in 25 minutes, a status that clears itself, /dnd for a focus block, and Workflow Builder for dated countdowns. For a live countdown in a channel, use a Marketplace app or a 15-line bot script.

    Slack Green Team5 min read
    Guide

    Slack Saved for Later: Where the Later Tab Is and How It Works

    Saved messages in Slack live in the Later tab, which replaced stars and Saved items in 2023. Hover a message and click Save for later, or press A. Add a reminder, mark items complete, and find them with is:saved. Where Later is on desktop and mobile, and what changed.

    Slack Green Team5 min read
      caffeinate Mac Terminal Command: Flags and Examples