AwakeMate AwakeMate

🛠️ How-to

How to keep your Mac awake (every method, honestly)

There are four real ways to stop a Mac sleeping: the caffeinate command, power-setting overrides, clamshell mode, and a tool that does it automatically. Here are the actual commands - and the catch with each.

1. The caffeinate command (the quick, safe one)

macOS ships caffeinate. It is the safest manual option because the moment the command ends, normal sleep returns - there is nothing to undo.

# Keep the Mac awake until you press Ctrl-C
caffeinate

# Keep awake for exactly 2 hours (7200 seconds)
caffeinate -t 7200

# Keep awake only until a specific command finishes
caffeinate -i make build

# Flags: -i idle sleep, -d display, -m disk, -s on AC, -u user active
caffeinate -dimsu

The catch: it is manual and all-or-nothing. You have to wrap each run and remember to stop it, it holds the whole Mac awake rather than a specific app, and it only works with the lid open.

2. Power-setting overrides with pmset (powerful, risky)

You can change the system power policy directly. These need sudo and persist until you change them back or reboot.

# Never sleep while on charger
sudo pmset -c sleep 0

# Set the system-wide sleep-disable flag (the strongest override)
sudo pmset -a disablesleep 1

# Undo it
sudo pmset -a disablesleep 0

The catch: it is system-wide and easy to forget - the Mac then never sleeps, even when idle, which drains the battery and runs it hot. On Apple Silicon, disablesleep can keep the Mac awake with the lid closed on many models, but Apple forces sleep on some, so it is not guaranteed.

3. Clamshell mode (the official lid-closed way)

Apple's supported way to use a Mac with the lid shut is clamshell mode. It needs hardware: connect the Mac to power, an external display, and an external keyboard or mouse, then close the lid and it keeps running.

The catch: you need a monitor and peripherals with you, and on M1/M2 MacBook Air only one external display is supported. It is reliable, but it is not "just close the lid and walk away."

4. The easy way: AwakeMate

AwakeMate does the same thing as caffeinate - the gentle, idle-sleep-only power assertion - but automatically, scoped to the apps and tools you choose. No command to start, none to remember to stop.

Automatic, per-tool

Awake only while your chosen apps or CLIs run - Xcode, ffmpeg, Claude Code - then it lets the Mac sleep.

Idle-aware

For CPU-bound jobs, turn on idle sleep so the Mac sleeps the instant the work is done. Nothing left holding it awake.

Safe by default

It never changes your saved energy settings and holds nothing system-wide to forget. No telemetry.

Lid-closed option

An optional lid-closed mode that works on most Apple Silicon Macs - test by closing yours. For guaranteed lid-closed, use clamshell.

Free 14-day trial · one-time $39.99 · no telemetry · macOS 13+

Which should you use?

One quick task, lid open

Use caffeinate -i your-command. Self-cleaning, nothing to undo.

Lid closed, guaranteed

Use clamshell mode with an external display and power.

You do this often

Use AwakeMate so it is automatic, per-tool, and you never babysit a command.

Running AI agents overnight? See why agents need your Mac awake.

Frequently asked

How do I keep my Mac awake from Terminal?

Run caffeinate. On its own it blocks idle sleep until you press Ctrl-C; caffeinate -t 3600 keeps it awake for an hour; caffeinate -i make build keeps it awake only until that command finishes. It works while the lid is open and holds the whole Mac awake, not a specific app.

Does caffeinate work with the lid closed?

No. caffeinate only blocks idle sleep while the lid is open. Closing the lid still sleeps the Mac unless you use clamshell mode (external display + power) or a tool that sets the system sleep-disable flag.

What is the difference between caffeinate and pmset disablesleep?

caffeinate is a temporary, per-session assertion that disappears when the command ends - safe and self-cleaning. sudo pmset -a disablesleep 1 sets a persistent system-wide flag that stays until you clear it or reboot, and needs root. It is more powerful but easy to forget and risky for the battery.

Is there a way that does not need Terminal commands?

Yes - AwakeMate. It watches the apps and tools you choose and keeps the Mac awake only while they run, then lets it sleep, with no commands to start or stop. It uses the same gentle assertion as caffeinate under the hood.

Skip the commands. Keep your Mac awake automatically.

Free 14-day trial. One-time $39.99, no subscription. macOS 13+.

Download for macOS Buy AwakeMate