16 / POWER · 5 min read
Caffeinate on Mac: How to Keep Your Mac Awake
caffeinate is built into macOS and needs no install. Here is what each option does, where it falls short, and a menu-bar alternative.
Open Terminal and run caffeinate: your Mac will not go to sleep from inactivity until you press Control + C or close the window. Add -t 3600 to stop after an hour, -d to keep the display on too, or put a command after it to stay awake only while that command runs.
caffeinate is a small command that ships with macOS. It asks the system not to sleep while it runs, which is useful for a long download, a build or a render. It has no window and no menu-bar icon, and it ends when Terminal does.
The basic command
Type caffeinate in Terminal and press Return. With no options it prevents idle sleep. The cursor does not come back: the command is running. Press Control + C to stop it, and the Mac follows its normal sleep settings again.
Options worth knowing
caffeinate -t 3600stays awake for 3600 seconds (one hour), then stops by itself.caffeinate -dalso prevents the display from sleeping.caffeinate -i makeruns a command (heremake) and holds the assertion only while it runs. This is the example in the manual page that ships with macOS (man caffeinate).caffeinate -w 1234waits for the process with ID 1234 to exit, then releases. Find an ID in Activity Monitor.caffeinate -sprevents system sleep, but only while the Mac is on AC power.
You can combine flags, for example caffeinate -d -t 1800 for thirty minutes with the display on. Run man caffeinate for the full list.
Check that it is working
Run pmset -g assertions in a second Terminal window. It lists the power assertions currently held, including the one caffeinate created. If the list shows nothing for caffeinate, the command has already ended.
What caffeinate does not do
- It is not a lid override. It stops idle sleep. A laptop with the lid closed still sleeps unless it is set up for clamshell use; see our clamshell guide.
- It dies with Terminal. Quit Terminal or close that window and the Mac can sleep again, with no warning.
- It is invisible. There is no menu-bar indicator, no timer readout and no battery limit. A long session on battery can run the battery down.
Without Terminal: the built-in settings
System Settings has its own sleep and display options under Battery, Lock Screen and Displays, and the wording changes between macOS versions. Apple’s guide to sleep and wake settings lists them, and our sleep guide walks through the common cases.
Where Tegaro fits
Tegaro Power has a Keep awake switch for people who want caffeinate’s result without a Terminal window. It holds the same kind of macOS power assertion: it stops idle sleep, and an option keeps the display on too.
- Start it from Settings → Power → Keep awake, or from the cup on the Power tile in the menu.
- Run it until you turn it off, for 30 minutes, 1 or 2 hours, or until a time you pick (the cup in the menu also offers 5 hours).
- Or let it switch on by itself while chosen apps are open, while a Claude Code or Codex task runs, while the Mac downloads or is busy, during a call, while an external display is connected, or while the Mac is plugged in. Each rule is its own switch and is off until you turn it on.
- Stop below a battery level you set; it resumes when the Mac is plugged in or the level is 3 % above the limit.
- The card shows what is keeping the Mac awake and until when.
Closing the lid still puts the Mac to sleep, as with caffeinate. Keep awake is part of Power, which stays free after the 14-day trial.
If you only need the Mac itself to keep working, let the display sleep and keep just the system awake. A screen left on for days wastes power and is not good for the panel.
Frequently asked questions
What does the caffeinate command do on Mac?
It creates a power assertion that stops the Mac from sleeping while it runs. With no options it prevents idle sleep; flags add display, disk or AC-power behaviour and a timeout.
How do I stop caffeinate?
Press Control-C in the Terminal window where it is running, or close that window. The Mac then follows its normal sleep settings.
Does caffeinate keep a MacBook awake with the lid closed?
No. caffeinate stops idle sleep, not the sleep that follows closing the lid. A closed laptop stays awake only in clamshell setups, which need an external display and power.
Is there a menu-bar alternative to caffeinate?
Yes. Tegaro Power has a Keep awake switch with timers, rules for apps, AI agents, downloads, load, calls, displays and the adapter, and a battery floor. Dedicated keep-awake utilities do the same job.