Mouse JigglerMade for Mac
macOS guides

Caffeinate Command on Mac: Keep Awake, Set a Timer & Stop

Use the Mac caffeinate command with practical -i, -d, and -t examples. Keep the screen or system awake, verify the request, and stop it with Control-C.

A silver laptop with a glowing command prompt beside a white coffee cup.
Editorial illustration
The quick answer

Open Terminal and run caffeinate -i -t 3600 to prevent idle system sleep for one hour. Add -d if you also need the display to stay on. Press Control-C to stop early.

What caffeinate actually does

caffeinate is a command included with macOS. It asks the operating system to prevent particular types of sleep while it runs. It does not move the pointer, click buttons, or change a chat app’s presence rules.

Think about what your task needs before choosing an option. A download may need the computer to remain awake while the display turns off. Reading a reference document or watching a dashboard may also require an illuminated screen.

Pick a command for your task

TaskCommand
A one-hour download; screen may turn offcaffeinate -i -t 3600
A 30-minute presentation; screen stays oncaffeinate -di -t 1800
A two-hour upload; screen may turn offcaffeinate -i -t 7200
Prevent idle sleep until you stop itcaffeinate -i

Paste only the command, then press Return. A quiet Terminal window is expected. Keep it open while the session runs. These are temporary requests, not changes to your saved sleep preferences.

Keep your Mac awake for one hour

  1. Open Terminal, which you can find with Spotlight.
  2. Enter the following command and press Return.
  3. Leave that Terminal session running until the task finishes.
caffeinate -i -t 3600

The timeout is measured in seconds: 1,800 is half an hour, 3,600 is one hour, and 7,200 is two hours. Terminal normally shows no progress bar. That is expected; a quiet window does not mean the command failed.

To stop before the hour ends, click the Terminal window and press Control-C. Normal sleep behavior can then resume according to your Mac’s settings.

Choose the right flags

OptionPurpose
-iPrevent idle system sleep.
-dPrevent display sleep.
-t 3600Release the request after one hour.
-sPrevent system sleep while on AC power.

For a one-hour session with the screen on, combine the options:

caffeinate -di -t 3600

Leaving the screen on uses additional energy. For a task that runs without supervision, keeping only the system awake is often the better fit.

What does caffeinate -d do?

-d requests that the display stay awake. -i requests that the system avoid idle sleep. Combine them as -di when you need both. A background download usually does not need an illuminated display; a presentation or reference screen often does.

Running caffeinate with no flags creates an idle-sleep prevention request. Be explicit with -i or -di so the purpose is easy to recognize when you return to the command.

Keep a command awake until it finishes

You can attach the sleep request to a command instead of estimating its duration. For example, in a project that uses make:

caffeinate -i make

The request lasts while that command runs. This is useful when a build’s completion time varies. The timeout flag is not used when a utility is supplied, so choose either a timed session or a command-scoped session.

When a menu-bar app is more convenient

Terminal works well for occasional, deliberate sessions. A menu-bar app is easier to revisit when you want recurring schedules, cursor movement, or controls tied to a particular app.

Mouse Jiggler offers an idle delay, movement interval, weekday schedules, and deactivation controls. See the scheduling walkthrough for an example. Neither approach should be treated as a promise that closing a MacBook lid will leave a task running.

For the exact options installed on your own Mac, open Terminal and run man caffeinate. Press Q to leave the manual.

How to stop caffeinate

  1. Return to the Terminal tab where you started the command.
  2. Press Control-C once.
  3. Check that the command prompt returns.

A timed command also stops automatically at its timeout. If you have several caffeinate sessions, ending one does not end the others. Stop the specific session you started; there is no need to change system-wide power settings or terminate unrelated processes.

Confirm the request in a second Terminal tab

While the session runs, open another Terminal tab and enter:

pmset -g assertions

Look for the caffeinate process in the process list. A session with -i should have a PreventUserIdleSystemSleep assertion; -di also requests PreventUserIdleDisplaySleep. After stopping your session, its process entry should disappear. Other apps may still have their own requests.

This read-only check helps distinguish a command that is running from a line you typed but never submitted. It does not establish that a remote download completed.

If your Mac still sleeps

Check whether the timeout already ended, the Terminal session closed, or the lid was closed. A timed idle-sleep request is not a guarantee against every sleep cause. If the system stays awake but a transfer stops, continue with the download and upload checks.

For an app that repeatedly reopens sessions, first identify it using Activity Monitor and the power-assertion check.

Sources & further readingApple: sleep and wake settings ↗
Command options checked against the built-in macOS caffeinate(8) manual. Read it on your Mac with man caffeinate.

Make your next session simpler.

Explore Mouse Jiggler’s menu-bar movement, timing, and scheduling controls.

Download for Mac