January 3, 2021

Mac Terminal commands to prevent Mac from sleeping

This is the syntax I use throughout this document:

syntax description
$ a shell prompt
text in monospaced font a command or other terminal text
underlined text a parameter you must replace with a value

These are the Terminal commands to keep your Mac display, system, or disk awake;” in other words: prevent it from sleeping:

commands description
$ caffeinate -d prevent display from sleeping
$ caffeinate -i prevent system from idle sleeping
$ caffeinate -m prevent disk from going idle
$ caffeinate -s keep Mac awake while it is plugged into AC power
$ caffeinate keep Mac awake as long as the Terminal is running. To stop process: Ctrl ⌃ + C
$ caffeinate -t n in second to keep you Mac awake for a set number of second e.g $ caffeinate -t 600

If you would like to learn more commands, I’ve put together a cheatsheet with the commands I use on my Mac Terminal. This is the summary of the cheatsheet:

Hey, I’m writing a book to explain how platforms and applications get away with what they promise they will do (and don’t do); and what impact your usage has on your well-being. You can sign up here to get an email when the book is out.

apple tools how-to command-line interface

No affiliates, No Google Analytics, No Facebook Pixel. © 2016-2021 Romain Aubert. Content is licensed under a CC BY-NC-SA 4.0. About this site.