Where caffeinate creates a temporary hold that keeps your Mac awake while a command runs, pmset changes your Mac’s actual power-management settings - permanently, until you change them back. It is the command-line equivalent of the Battery and Energy settings panels, with a few extra switches. Used carefully it is powerful; used carelessly it is an easy way to leave your Mac awake forever. Here is the safe way to use it.
Reading your current settings (no sudo needed)
Inspection is harmless and needs no privileges. Start here:
# The settings in effect right now
pmset -g
# Per-power-source settings (battery vs charger)
pmset -g custom
# Everything currently holding the Mac awake
pmset -g assertions
# Battery / charge status
pmset -g batt
pmset -g assertions is the one to remember when you are debugging “why won’t my Mac sleep”: it lists every active assertion, including ones created by apps, downloads, or a caffeinate you forgot about.
The settings that control sleep
Three keys decide how your Mac sleeps, each measured in minutes (with 0 meaning “never”):
| Key | Controls |
|---|---|
sleep | Full system sleep |
displaysleep | Turning the display off |
disksleep | Spinning the disk down |
Changing any of them needs sudo, and you choose which power source it applies to:
-aall sources-bbattery only-ccharger (AC) only
# Never sleep the system while on power
sudo pmset -c sleep 0
# Turn the display off after 15 minutes on battery
sudo pmset -b displaysleep 15
There is also a stronger switch, disablesleep, which fully disables sleep (including when the lid closes) and is sometimes used for clamshell setups:
sudo pmset -c disablesleep 1
Use that one sparingly - it overrides the normal safety behaviour of closing the lid.
Putting it back
pmset changes are persistent and survive reboots, so you must undo them deliberately. Set sensible values back:
sudo pmset -a sleep 1
sudo pmset -c disablesleep 0
If you are not sure what your defaults were, pmset -g custom (run before you change anything) is worth saving somewhere first.
Why this is usually the wrong tool
pmset works, but for “keep my Mac awake while this runs” it is almost always heavier than you want:
- It is global and permanent. Once you set
sleep 0, your Mac stays awake for everything, day and night, until you remember to revert. That is battery drain and needless wear. - It needs sudo. Every change is an administrator action.
- It has no concept of your task. It cannot stay awake for a build and then sleep when the build finishes. It only knows “on” and “off”.
For a temporary hold tied to a specific job, caffeinate -i <command> is the right tool - it releases automatically when the command exits, no sudo, nothing to undo. Reserve pmset for genuinely permanent policy changes, like a Mac mini server that should never sleep.
The automatic middle ground
Most people do not want “never sleep” (pmset) or “remember to run a command every time” (caffeinate). They want: awake while my work runs, asleep the rest of the time - without thinking about it.
That is what AwakeMate does. It watches the tools you choose - builds, renders, downloads, backups, AI agents - and holds the Mac awake only while they are active, then lets normal sleep resume. It uses the same temporary power assertion as caffeinate, so it never rewrites your pmset settings or your Energy Saver panel. Your saved power behaviour stays exactly as it was; AwakeMate just fills the gaps while real work is happening.
If you want the command line, learn caffeinate for one-offs and keep pmset for permanent server-style policy. If you want it handled for you, let an app do it.