Skip to content
Back

lid

Open source Mac utility · Aug 2026

It keeps a Mac awake while a coding agent is working, including with the lid shut. Close the laptop, put it in a bag, and the turn that was running is still running.

$ lid session
lidawake while an agent works, 4m 12s so far
sleeps 30s after the last agent stops
agentsclaude  57609482  working  8s
codex   9c8b7a6d  idle     2m 30s
guardsbattery   62%, on battery
thermal   nominal
lowpower  off
timecap   0.1h of 3.0h
The lid is shut and the counter is still going. That is the whole product.

Almost all of it is invisible. The tool succeeds by nothing happening, so there is no screen to design and no moment to make satisfying. There is one line in the menu bar, and that is the entire interface.

I deleted a row from it, and the deletion caught the app lying.

1 working
Awake 4m 12s, 1 agent working
battery62%, on battery
  • Keep awake for 24 hours
  • Awake while agents work
  • Sleep normally
1 working
Awake 4m 12s, 1 agent working
  • Keep awake for 24 hours
  • Awake while agents work
  • Sleep normally
Both panels are the real menu, worded exactly as the app words it.

The battery row was the second thing anyone read. macOS already shows the battery two icons away, so that row was spending the one line people actually read on something they could already see. I cut it.

What it had been covering only showed up once it was gone. In the second case the panel now said Sleeping normally and nothing else. True, and useless. Someone who asked for a hold and did not get one decides the tool is broken. So it names the limit that is refusing.

What counts as working

Keeping a Mac awake is one line of code. Knowing when to stop is the product.

Tools that watch for a running process keep the machine awake for as long as your terminal is open, which is most of the day. An agent sits idle far longer than it works. So this watches the turn instead, using the lifecycle hooks Claude Code and Codex already fire.

A turn ends three ways. Only one of them is the one everybody handles.

Stop
releases
releases

Listen only for the first and the Mac stays awake indefinitely on the other two, with nothing left to wait for.

Why caffeinate cannot do this

There is more than one road to sleep, and the well known tool parks a barrier on the wrong one.

Two routes to sleep on a MacAn idle-sleep assertion blocks the idle route. The lid-close route runs past it untouched, which is why the Mac still sleeps.your Macidle for 10 minutescaffeinate stops it hereyou close the lidasleepno barrier on this one

The only thing that closes the lower road is a machine wide setting that needs root, so it cannot simply be left on.

The proof

What has to be proved here is an absence, which is harder to show than a feature.

16:23:19↖ logging stops here
16:23:19lid shuts 16:31:3317:08:18
269 samples, ten seconds apart. 220 of them with the lid shut, 36 minutes 45 seconds, never returning to open. The largest interval anywhere in the file is eleven seconds; a sleep would be minutes. The raw log and the script that drew it are both in the repo.

Five commands, and the one I did not build

session, open, stop, status, setting. Named after what you want, not after how it works.

There is no doctor. Nobody runs a diagnostic they have to think of first, and this tool fails silently by design, so the health check lives inside status, which is where people already go when something feels wrong.

Six words in the menu bar

0
running, holding nothing

0 and lid off sit next to each other and mean opposite things. One is running and holding nothing. The other is not running at all. A blank title would have merged them, and this is not a tool that can afford to look the same when it is dead.

Asking a stranger for sudo

The install writes a sudoers rule, which is a lot to ask of someone who found the repo an hour ago. It covers exactly two commands, it is checked with visudo before it goes in, and it is staged as a script you read before you run it. Nothing pipes a URL into a shell.

What I do not know

Verified on one machine. Apple M3 Pro, macOS 26.6, internal display, on battery. Intel, older macOS, and clamshell with an external display are all untested, and the lid is the entire product, so those are gaps rather than caveats.

A failure report is worth more to me than a success one.

MIT · 69 tests, no third party dependencies · github.com/kuanrur/holdlid