latte

Keep your Mac awake while an agent works.

A small wrapper around macOS caffeinate. Pick whether the screen stays on and for how long, and latte picks the flags.

macOS, Apple silicon or Intel
curl -fsSL https://raw.githubusercontent.com/Junnyyy/latte/main/install.sh | bash

v0.4.0Nov 6, 2026Read install.sh

Update, uninstall, or build from source

Run the same command to update. It skips the download when you already have the latest version.

It installs to ~/.local/bin/latte and tells you if that folder isn't on your PATH. To uninstall, delete that file.

To build from source, you need Bun.

git clone https://github.com/Junnyyy/latte.git
cd latte
bun install
bun run install:global

Run it on its own for a live dashboard

latte with no arguments opens this. The copy here runs in your browser, so it can't keep your Mac awake, but the keys work. Click it and press o.

latte.
○ Inactive — no caffeinate running

Inactive — no caffeinate running

Pick the command for what you're doing

  • You hand work to an agent and walk away for lunch, a meeting, or the night. The Mac stays awake. The screen sleeps and locks as usual.

  • You're watching the agent's output, or presenting from this Mac. The Mac and the screen both stay awake.

  • You want it to stop on its own after a set time. Takes s, m, or h. Add --screen to keep the screen on too.

  • Stay awake only while this Claude Code session runs. When it ends, the Mac can sleep again.

  • See what's keeping the Mac awake, how long it has run, and what it's waiting for.

  • Stops every running caffeinate, latte's or not. Safe to run when nothing is running.

Keep the lid open. macOS can still sleep the Mac when you close it, whatever latte holds.

Stay awake while an app runs

--while takes an app name or a PID. When that process exits, caffeinate exits too and the Mac can sleep again. Give it a duration as well and whichever comes first ends the session.

  • until this Claude Code session ends

  • until Cursor quits

  • until VS Code quits, for at most 2 hours

  • until the process with PID 4242 exits

  • until this terminal closes

claude watches the Claude Code session it runs inside, so run it from that session or ask the agent to. code and vscode watch VS Code. Any other app works by its name. If a name matches several processes and latte can't tell which one you mean, it lists their PIDs and exits with code 1.

For agents

When its output isn't a terminal, every command prints plain text and never opens the dashboard. latte off succeeds even when nothing is running, so a script can call it without checking first. An unknown option fails with exit code 1 instead of being ignored.

To have your agent do this on its own, add a line to AGENTS.md or CLAUDE.md:

Before a long-running task, run `latte on --while claude`.
It keeps the Mac awake until this session ends.

How it works

latte has no daemon, no config file, and no PID file. Every command reads the running processes instead:

  1. pgrep -x caffeinate finds a running caffeinate.
  2. ps reads its flags, start time, timeout, and the PID it waits for.
  3. pkill -x caffeinate stops every running caffeinate, including ones latte didn't start.

The two presets map to these flags:

latte on
-is
Mac stays awake, screen can sleep
latte on --screen
-dis
Mac and screen stay awake

Earlier versions used -imsu. Without a timeout, caffeinate drops the -u and -m assertions after about five seconds. With one, it holds them for the whole session. So latte on and latte 30m quietly behaved differently. The presets now leave both out.

When you need exact flags

--flags replaces the preset with exactly the caffeinate letters you pass, and ignores LATTE_FLAGS. It can't be combined with --screen, so add d instead.

  • exactly -dims, no preset

  • exactly -im, for two hours

-d
Prevents the display from sleeping. This also prevents idle system sleep.
-i
Prevents idle system sleep. The display can still sleep.
-m
Prevents disk idle sleep.
-s
Prevents system sleep. It applies only on AC power.
-u
Declares user activity. Without a timeout, caffeinate drops it after 5 seconds.

To add a flag to every preset session, set LATTE_FLAGS in your shell profile. This one keeps the screen on every time:

echo 'export LATTE_FLAGS="-d"' >> ~/.zshrc

In the dashboard, press f to toggle letters and Enter to apply them. A running session restarts with the new flags and keeps its time left.