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.

1 working
claude · holdlid0m 52s
> add the compatibility table to the readme
Read README.md
Read src/holdlid/power.py
Update README.md+18 -2

Lid open, the agent is working.

Shut it with lid installed and the log keeps moving. Shut it without and the turn stops where it stood. Nothing else about the two is different.

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 behind it this.

1 working
Awake 4m, 1 agent working
Keep awake for 24 hours
Awake while agents work
Sleep normally
Quit this menu⌘Q
the background service keeps running
The whole interface. Worded exactly as the app words it.

It used to have one more row. Deleting it caught the app lying.

The row sat under the headline and printed the battery level. macOS already shows the battery two icons away, so it 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. With a limit refusing to hold, the panel 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.

it finishesStopreleasesreleases
an API error kills itStopFailurenever releasesreleases
you close the terminalSessionEndnever releasesreleases
On the bottom two rows a tool waiting for Stop is waiting for something that never arrives, so it holds the Mac awake until you happen to notice. That is why lid listens for all three.

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