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.
On this page
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 flags
From man caffeinate:
| Flag | What it does |
|---|---|
-d | Prevents the display from sleeping |
-i | Prevents the system from idle sleeping (the default with no flags) |
-m | Prevents the disk from idle sleeping |
-s | Prevents the system from sleeping, only on AC power |
-u | Declares that the user is active; turns the display on if it is off. Lasts 5 seconds unless you add -t |
-t seconds | Drops the assertion after that many seconds |
-w PID | Keeps it until the process with that ID exits |
command | Keeps it while the command runs |
caffeinate -i vs -d
- •
caffeinate -ikeeps the computer running, but the display can still turn off. Use it for downloads, backups and builds. - •
caffeinate -dkeeps the display on. Use it when you want the screen visible, or to stop the screen saver and the lock that follows it. - •
caffeinate -didoes both. Flags combine, socaffeinate -dimssets four at once.
caffeinate examples
Ne jamais plus apparaître "absent" sur Slack
Basé sur le cloud. Sans téléchargement. Fonctionne 24/7 même avec votre PC éteint.
# 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
killall caffeinate.-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?
Ne jamais plus apparaître "absent" sur Slack
Basé sur le cloud. Sans téléchargement. Fonctionne 24/7 même avec votre PC éteint.
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.
Arrêtez de Bouger la Souris.
Des centaines de télétravailleurs ne se soucient plus de leur statut Slack. Configurez une fois, restez vert pour toujours.
Related Articles
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 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 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.