Skip to content
86% off$349 $48.86code BF2026

Docs

Glowmoth docs25 pages

caffeinate -dimsu meaning: what each flag does on Mac

What caffeinate -dimsu means flag by flag (d, i, m, s, u), which flags you need, and which ones Glowmoth's menu bar app and CLI can replace.

Updated 6 min read

On this page

You found caffeinate -dimsu pasted as the answer to "how do I keep my Mac awake" and you want to know what the "imsu" part is for. Fair question: it is a stack of five flags, and most people need one or two of them.

What each flag in caffeinate -dimsu does

caffeinate ships with macOS, so there is nothing to install. Run it in Terminal and leave the window open:

bash
caffeinate -dimsu

It holds its sleep assertions until you press Control-C or close the window. It changes no system setting, so there is nothing to undo.

FlagWhat it doesGlowmoth equivalent
-dPrevents the display from sleepingKeep the display on (on by default for your session)
-iPrevents idle system sleep; the display may still sleepA session with Keep the display on turned off
-mPrevents the disk from idle sleepingNone
-sPrevents system sleep; only works on AC powerNone
-uDeclares the user active (wakes the display if it is off)None
-t <seconds>Stops after a number of secondsglowmoth for 2h
-w <pid>Stays awake until that process exitsglowmoth wait <pid>
a commandStays awake while the command runsglowmoth run -- <command>

Why the combination looks redundant

The flags overlap, and a few have catches:

  • -d already implies a lot. Holding the display on also keeps the system awake, so -d alone covers many "just keep it on" cases.
  • -s only works on AC power. On a MacBook running on battery it has no effect, so -dimsu behaves like -dim there.
  • -u is short-lived by default. Without -t, the user-active assertion lasts only 5 seconds. In -dimsu, the other flags do the long holding. -u mostly matters when the display is already off and you want it woken.
  • Plain caffeinate is just -i. With no flags it blocks idle sleep, but the display can still go dark.

Which flags you actually need

Pick by the job:

JobCommand
Long download, build or agent run; screen can go darkcaffeinate -i
Screen must stay on (presentation, dashboard)caffeinate -d
One command, then let the Mac sleep againcaffeinate -i make
A fixed timecaffeinate -i -t 3600 (seconds)
Until a running process finishescaffeinate -i -w 1234

For example, this holds the Mac awake while make runs and releases it when make exits:

bash
caffeinate -i make

Add -m only if you have a spinning external disk that must not idle, and -u only if you need the display woken. -s matters mainly on a desktop or a plugged-in laptop where you want the stronger system-sleep hold.

Check that it is working

In a second Terminal window, run:

bash
pmset -g assertions

This lists every sleep-blocking assertion and the process holding it. You should see caffeinate with the assertions you asked for. It also shows whether something else is holding the Mac awake.

Doing the same with Glowmoth

Glowmoth is a menu bar app that covers -d, -i, -t, -w and the command wrapper. It does not cover -s, -m or -u. The point of it is that you can see and stop the hold without keeping a Terminal window open.

Glowmoth holds one power assertion at a time, in one of two kinds: system only (like -i) or display on (like -d). Each one is named, for example "Glowmoth: Session for 1 hour", so pmset -g assertions explains it.

To use it from Terminal, install the command-line tool under Settings ▸ Advanced ▸ Command Line ▸ Command-line tool ▸ Install. Then:

bash
glowmoth for 2h
glowmoth on --no-display
glowmoth wait 1234
glowmoth run -- make
  1. glowmoth for 2h keeps the Mac awake for two hours, like caffeinate -t 7200. It follows your Keep the display on setting; add --no-display to let the display sleep.
  2. glowmoth on --no-display starts a session with your default duration and lets the display sleep, like -i. The default is Indefinitely until you change it in Settings ▸ Sessions.
  3. glowmoth wait 1234 stays awake until process 1234 exits, like -w.
  4. glowmoth run -- make stays awake while make runs and returns its exit code. If the app isn't running, it holds its own assertion, so it still works.

Glowmoth needs a license or an active trial to hold the Mac awake. Without one, the app holds nothing.

What has no Glowmoth equivalent

  • -s: Glowmoth never uses the "prevent system sleep" assertion. For a MacBook with the lid closed it has a separate closed-lid mode, which needs a helper approved in Login Items. It is not a substitute for -s.
  • -m: there is no disk-idle assertion. Keep drives from sleeping (Settings ▸ Advanced ▸ Drives) writes a small hidden file to the external or network drives you choose every few minutes. That is a different mechanism.
  • -u: Glowmoth cannot declare the user active or wake the display.

If you need those three, keep using caffeinate. For the other flags, the built-in tool is free and perfectly good; an app only adds a visible on/off state, rules and a list of what else is holding the Mac awake.

Checklist before you try again

  • The Terminal window running caffeinate is still open (or you used a menu bar app).
  • You added -d if the screen must stay on.
  • You are on AC power if you rely on -s.
  • pmset -g assertions shows the assertion you expect.
  • You are not testing with Apple menu ▸ Sleep or a closed lid.

If it doesn't work

  • The display still sleeps. You used -i or plain caffeinate. Add -d, or in Glowmoth turn on Keep the display on.
  • The Mac sleeps when you close the lid. Neither a normal caffeinate run nor a normal Glowmoth session stops lid-close sleep. Glowmoth's closed-lid mode exists for laptops, with the limits on its page.
  • It stopped when you closed Terminal. caffeinate ends with its window. Keep the window open, or use a menu bar app.
  • -s does nothing. You are probably on battery.
  • Something else forces sleep. Check pmset -g assertions for a scheduled sleep or an auto log-out. Glowmoth's panel lists other apps holding the Mac awake under Show More (Also Keeping This Mac Awake), including caffeinate, and flags scheduled sleep and auto log-out.

If none of this explains it, contact Apple Support, or the app's developer if a third-party app is involved. Include your macOS version, whether it is a laptop or desktop, the exact command, and the output of pmset -g assertions.

text
My Mac sleeps even though I ran "caffeinate -dimsu".
macOS version: (your version). Mac model: (your model).
Power: AC / battery. Lid open / closed.
Output of "pmset -g assertions" is attached.
What I already tried: -d alone, -i alone, keeping Terminal open.

Common questions

Is -dimsu better than -di?

Not usually. -d and -i cover the display and idle system sleep. Add -m for idle disks, -s on AC power, -u to wake the display, only if you need them.

Does caffeinate survive a restart or logout?

No. It runs as a normal process and ends when you stop it, close its window, or the session ends. Nothing persists.

Can I run caffeinate for a set time?

Yes: caffeinate -i -t 3600 holds for 3,600 seconds. Glowmoth's equivalent is glowmoth for 1h.

Why does the Mac still sleep with the lid closed?

These assertions block idle sleep, not lid-close sleep. A MacBook normally sleeps on lid close unless it has power and an external display, or a dedicated closed-lid mode is on.

Every app.
One purchase.