How to Keep Your Mac Awake
Stop your Mac from sleeping during downloads, presentations and long builds. Three ways to keep it awake: System Settings, the caffeinate command, and the free Coffee extension.
Stop your Mac from sleeping during downloads, presentations and long builds. Three ways to keep it awake: System Settings, the caffeinate command, and the free Coffee extension.
Your Mac goes to sleep to save power. That's great until it happens in the middle of a 40 GB download, a long build, or a slide you've been talking over for five minutes.
The short answer: to keep your Mac awake for a while, run caffeinate -d in Terminal, or install the free Coffee extension for Raycast and run Caffeinate. To change it for good, go to System Settings → Lock Screen and set the display to never turn off.
This guide walks through all three, and when to use each.
| Method | Best for | Time limit | Stays on after restart |
|---|---|---|---|
| Coffee for Raycast | Everyday use, one keystroke | Yes: for, until, while an app runs, schedule | Optional |
caffeinate in Terminal | One-off, scripts | Yes, in seconds | No |
| System Settings | Never sleeping, permanently | No | Yes |
Coffee is a free extension with more than 160,000 installs. It uses macOS's own caffeinate command under the hood, so it's as reliable as Terminal, and you never have to touch your settings.
Open Raycast and type one of these:

1h 30m.5pm.Turn on Caffeinate Status Menu Bar to see a coffee icon in your menu bar whenever your Mac is being kept awake, and click it to stop.
You can also just ask. In Raycast AI, type @, pick Coffee and say what you need, like “keep my Mac awake until the download finishes at 3pm”. Coffee sets it up.
By default Coffee keeps the display, the system and the disk awake. In the extension's preferences you can turn any of these off, or keep your Mac awake whenever it's plugged in.
Hotkeys and aliases work on almost any Raycast command, including this one. This three-minute video shows how to set them up:
Every Mac comes with caffeinate. It keeps your Mac awake for as long as the command is running.
caffeinate -d and press Return.Control C when you're done.Useful options:
caffeinate -d: keep the display on.caffeinate -i: stop idle sleep but let the display turn off.caffeinate -t 3600: stay awake for 3,600 seconds (one hour), then stop.caffeinate -s: stop system sleep while plugged in.caffeinate -i make build: stay awake only while a command runs.If you never want your Mac to sleep, change the settings. This applies all the time until you change it back.
The downside: your Mac never sleeps, even when you forget about it, which wastes power and shortens battery life. For most people, a time-limited method above is the better choice.
For a one-off, run caffeinate -d in Terminal or use Coffee in Raycast. To change it permanently, set the display to Never turn off in System Settings → Lock Screen, and on a laptop turn on Prevent automatic sleeping on power adapter in Battery → Options.
A MacBook sleeps when you close the lid unless it's in clamshell mode: plugged in and connected to an external display, with an external keyboard or mouse.
Yes. A Mac that can't sleep keeps using power, and a screen that stays on uses the most. Use a time limit, like Caffeinate for… or caffeinate -t, so your Mac goes back to normal on its own.
caffeinate is a command built into macOS that prevents sleep while it runs. Coffee uses it under the hood, so you get the same reliability without opening Terminal.
Coffee is free and open source, and it covers the common cases: a set time, until a time, while an app runs, and weekly schedules, with a menu bar status. It works on Windows too. If you already use Amphetamine, the Amphetamine extension lets you start and stop its sessions from Raycast.
More guides
Find out what's slowing your Mac down. Check CPU and memory usage with Activity Monitor, a few Terminal commands, or the free System Monitor extension for Raycast.
Connect your AirPods, headphones, keyboard or mouse without digging through menus. Three ways to do it on a Mac: Control Center, System Settings, and the free Toothpick extension for Raycast.
Grab text from screenshots, images, videos and apps that won't let you select it. Three ways to do it: Live Text in Preview and Photos, the screenshot thumbnail, and the free ScreenOCR extension.
When an app freezes, press ⌥ ⌘ Esc to force quit it. Here's every way to quit and force quit apps on a Mac, from the keyboard, the Dock, Activity Monitor, Terminal and Raycast.
