Keep the Mac awake temporarily
If a download or script needs more time than your usual idle-sleep interval, open Terminal (Command-Space, then type Terminal). Enter caffeinate -t 3600 and press Return. The number is a duration in seconds: 3600 means one hour. Leave that Terminal session running while the task continues. When the timeout expires, the sleep-prevention assertion ends; your Mac can then follow its normal sleep settings again. You do not need to change System Settings.
Choose the right form
caffeinateprevents idle system sleep until you stop the command.caffeinate -t 3600does the same for up to one hour.caffeinate -d -t 3600additionally keeps the display from sleeping during that period. Use the display option only if you actually need the screen on.
For a specific Terminal task, you can also run caffeinate -i your-command so the assertion lasts for that command's execution. Replace your-command with the real command and its arguments; do not type the placeholder literally.
Stop it and know its limits
Press Control-C in the Terminal session to stop a running caffeinate command early. The command prevents automatic idle sleep, not every kind of sleep: choosing Sleep manually or closing a Mac laptop lid can still put it to sleep. It also does not guarantee that a download, network connection or backup will succeed. Keeping a Mac awake or its display on may increase power consumption, especially on battery. Prefer a timeout that covers only the work you need.
Sources
Selected references used to verify or support this tip.
- Set sleep and wake settings for your Mac Apple Support · official_docs
- Put your Mac to sleep or wake it Apple Support · official_docs
- caffeinate(8) — BSD System Manager’s Manual Darwin manual (manpagez mirror) · other
Checked