Built in
How to keep a Mac awake without installing an app
macOS has three built-in ways: System Settings, caffeinate and pmset. Exact menu paths, Terminal recipes for downloads and timers, and their limits.
Short answer: macOS has three built-in ways to keep a Mac awake: the sleep options in System Settings, the
caffeinatecommand, andpmsetfor advanced users. For a download or a long command with the lid open,caffeinate -iis enough:caffeinate -i curl -L -O <url>keeps the Mac awake until the download ends, andcaffeinate -i -t 7200keeps it awake for two hours. None of them keeps a closed MacBook awake without an external display safely: onlysudo pmset disablesleep 1gets past the lid, and it stays on until you undo it.
Which System Settings stop a Mac from sleeping?
Three places, as of October 2026 on macOS 26 and later, per Apple's Mac User Guide. They control sleep after inactivity, not the lid.
| Setting | Where | What it does |
|---|---|---|
| "Turn display off on battery when inactive" | System Settings > Lock Screen | How long the Mac waits on battery |
| "Turn display off on power adapter when inactive" | System Settings > Lock Screen | How long the Mac waits on the charger |
| "Prevent automatic sleeping on power adapter when the display is off" | System Settings > Battery > Options (laptops) | The Mac keeps running after the display turns off, while plugged in |
| "Prevent automatic sleeping when the display is off" | System Settings > Energy (desktops) | The same for a Mac mini, iMac or Mac Studio |
Apple uses the two Lock Screen menus to set how long the Mac waits before it sleeps (If your Mac sleeps or wakes unexpectedly). The Battery option will "Prevent your Mac from sleeping when it's plugged in and its display is off" (Battery settings), and the Energy option will "Prevent your Mac from going to sleep automatically when its display is off" (Energy settings). Apple adds: "delaying, preventing, or allowing disruption of sleep may increase power consumption" (Apple Support).
For a MacBook on its charger, turn on the Battery option and leave the lid open: the display can go dark while the Mac keeps working. On battery there is no such switch, only the display timer.
How do I keep a Mac awake from Terminal?
Use caffeinate, which ships with macOS at /usr/bin/caffeinate. The man page: "If no assertion flags are specified, caffeinate creates an assertion to prevent idle sleep." With a command after it, the assertion lasts "for the duration of the utility's execution"; without one, until caffeinate exits (press Control-C).
caffeinate -i curl -L -O https://example.com/big.zip # until the download ends
caffeinate -i make # while a command runs (Apple's example)
caffeinate -i -t 7200 # for 2 hours (7,200 seconds)
caffeinate -i -w 4242 # until process 4242 exits
caffeinate -i -w "$(pgrep -n -x rsync)" # until the newest rsync exits
caffeinate -d -i # keep the display on too, until Control-C
The options, from man caffeinate:
-iprevents idle sleep;-dkeeps the display on as well.-tsets the timeout in seconds, and is "not used when an utility is invoked".-w"Waits for the process with the specified pid to exit", and "is ignored when used with utility option".pgrep -npicks "the newest (most recently started)" match, and-xrequires an exact name (man pgrep).-salso prevents system sleep, but "is valid only when system is running on AC power."
How do I keep a MacBook awake while downloading?
Wrap the download in caffeinate when you start it from Terminal, as in the curl line above. For a download in a browser or an app, run caffeinate -i -t with a time longer than the download needs. To see whether the app already holds the Mac awake, run pmset -g assertions and look for its name under Listed by owning process:.
How do I check that it works?
Run pmset -g. While something holds an assertion, the sleep line ends with a note such as (sleep prevented by caffeinate) (pmset.m), and pmset -g assertions lists PreventUserIdleSystemSleep 1.
caffeinate stops at the lid: Apple says that with this assertion "The system may still sleep for lid close, Apple menu, low battery, or other sleep reasons" (Apple developer docs). The details are in why caffeinate does not keep your MacBook awake with the lid closed.
How do I change sleep settings with pmset?
pmset changes the saved power settings, so it needs sudo: "pmset must be run as root in order to modify any settings." Changes are stored "per-system, not per-user", and "pmset modifies the same file that System Settings modifies" (man pmset).
pmset -g custom # current settings under "Battery Power:" and "AC Power:"
sudo pmset -c sleep 0 # no idle sleep on the charger (0 means never)
sudo pmset -c displaysleep 15 # display off after 15 minutes on the charger
pmset displaysleepnow # turn the display off now
sudo pmset restoredefaults # back to the default power settings
From the man page: sleep is the "system sleep timer (value in minutes, or 0 to disable)"; -c means "charger (wall power)", -b battery and -a all; restoredefaults "Restores power management settings to their default values."
The risks: a change stays until you change it back, -a or -b applies it on battery too, and it affects every user of the Mac. Write down the old values from pmset -g custom before you start.
What about sudo pmset disablesleep 1?
It is the one built-in command that gets past the lid. It turns on SleepDisabled, and the Mac stops sleeping for any reason, on AC power and on battery, even after a restart (PMSettings.m), until sudo pmset disablesleep 0. It is not in man pmset; Apple's pmset source defines it. Use it only for a job you will watch, and check afterwards that pmset -g | grep SleepDisabled shows 0. Full details: what sudo pmset disablesleep 1 does and how to undo it.
What can't the built-in options do?
They cannot keep a closed MacBook awake without a display, safely. Closing the display puts a Mac laptop to sleep (Apple Support), and the built-ins cover it only in two ways:
- Closed-display mode keeps it running with an external display, keyboard and mouse, and power connected (Apple Support). See clamshell mode without an external monitor.
- The disablesleep switch,
sudo pmset disablesleep 1, has no timer, no battery floor and no heat check, and survives a restart.
"Wake for network access" and Power Nap work while the Mac sleeps, to provide shared resources or check for updates (Energy settings); neither keeps your own task running. The whole map is in how to prevent a MacBook from sleeping when the lid is closed.
Careful: A closed MacBook that is awake still makes heat. Apple says to use a Mac laptop "on a stable work surface that allows for good ventilation" and not "in your bed, on a pillow, or under bedding" (Apple Support). Never close an awake Mac into a bag.
What to use
With the lid open, the built-ins are free and enough: the Battery option on the charger, or caffeinate -i for one job. To keep a MacBook with Apple silicon awake with the lid closed and no external display, Keep Mac Awake (keepmacawake.com) turns the same SleepDisabled setting on for a session you start with keepmacawake start --hours 8, supervises it with a watchdog and restores normal sleep afterwards. It is an app, so it needs installing, on macOS 26 or later; sessions run on AC power by default, and it is free for 3 days, then 9 USD once per Mac plus tax. It does not keep Wi-Fi alive or wake a Mac that is already asleep. More on how to keep a MacBook awake with the lid closed.
FAQ
How do I keep my Mac awake without downloading an app?
Turn on "Prevent automatic sleeping on power adapter when the display is off" in System Settings > Battery > Options, or run caffeinate -i in Terminal. Both work with the lid open.
What is the Terminal command to keep a Mac awake?
caffeinate -i, which prevents idle sleep until you press Control-C. Add -t 3600 for one hour, -w PID to wait for a process, or put a command after it.
How do I stop my Mac from sleeping in System Settings?
On a laptop, open System Settings > Battery > Options and turn on "Prevent automatic sleeping on power adapter when the display is off". On a desktop, use "Prevent automatic sleeping when the display is off" in System Settings > Energy.
How do I keep my MacBook awake while downloading?
Start the download through caffeinate -i, as in caffeinate -i curl -L -O <url>, or run caffeinate -i -t with a time longer than the download. Keep the lid open.
Can I keep a MacBook awake with the lid closed without an app?
Yes, with closed-display mode (display, keyboard, mouse and power), or with sudo pmset disablesleep 1, which stays on until you run sudo pmset disablesleep 0.
Sources
- Apple Support: Set sleep and wake settings for your Mac
- Apple Support: If your Mac sleeps or wakes unexpectedly
- Apple Support: Change Battery settings on a Mac laptop
- Apple Support: Change Energy settings on a Mac desktop computer
- Apple Support: Put your Mac to sleep or wake it
- Apple Support: If your external display is dark
- Apple Support: Mac laptop operating temperatures
man caffeinate,man pmsetandman pgrepon macOS- Apple open source: pmset.m and PMSettings.m
- Apple developer docs: kIOPMAssertionTypePreventUserIdleSystemSleep
- Keep Mac Awake: command line