
Closing your MacBook lid kills your Claude Code/Codex session. So I built a tiny menu bar app that keeps the Mac awake (free, open source)
You kick off a long Claude Code or Codex run, close the lid to go grab food, and come back to a dead session. macOS sleeps the instant the lid closes unless an external display is plugged in, and it takes your agents, builds, downloads, and local servers with it.
I got tired of babysitting an open laptop, so I built **LidAwake**: a tiny native macOS menu bar app that keeps the Mac running with the lid shut.
* Coffee cup icon in the menu bar: click to toggle, filled cup = Mac stays awake lid-closed
* Saves your screen brightness when the lid closes and restores it exactly on reopen
* Start at Login, light/dark mode, native AppKit
* About 200 lines of Swift total. No Electron, no daemons, a few MB of RAM
* MIT licensed, builds from source in seconds with an included script
The fun engineering bit: macOS fires no display-sleep event when the lid closes; it silently disconnects the built-in display instead. Lid detection ended up being a 2-second poll of IOPMrootDomain's AppleClamshellState.
And yes, fittingly, I built it with Claude Code in an afternoon, so it can keep its own kind alive overnight.
GitHub: https://github.com/deezeddd/LidAwake-Mac
Github Page: https://deezeddd.github.io/LidAwake-Mac/
It's my first open-source release. Feedback on the README, the approach, or anything else is very welcome.
EDIT: Here is a one-liner CLI Command:
curl -fsSL https://raw.githubusercontent.com/deezeddd/LidAwake-Mac/main/install.sh | bash