Developer Tools

Insomnia

Keep coding agents running with your MacBook closed

Last verified October 2026 4 min read

What is Insomnia?

Insomnia product thumbnail

Insomnia is a macOS menu bar app for developers who want coding agents to keep running while a MacBook lid is closed. You start a timed session from the menu bar, and it keeps the Mac awake while dimming the display, freezing selected apps, and applying battery and heat rules. It requires macOS 26 or later on Apple silicon and is open source under the MIT license.

Why Insomnia works

Closing a MacBook normally stops the kind of long coding agent run you meant to leave working, while simply forcing the machine awake can waste battery or leave changed system state behind. Insomnia pairs a timed awake session with battery, heat, and on disk recovery rules, so the agent keeps working instead of the laptop sleeping or staying altered after the session ends.

Insomnia features

  • Timed awake sessions. Pick days, hours, and minutes from the menu bar. The countdown can be extended during a session, and ending early requires holding the control for 0.6 seconds.
  • Lid closed agent runs. Closing the lid keeps the timer and coding agents running while the display and keyboard light turn off, audio is muted, and selected apps can be frozen.
  • Battery and heat rules. The defaults turn on Low Power Mode below 40 percent battery and end the session below 10 percent. Serious heat triggers Low Power Mode, while critical heat ends the session.
  • Recovery journal. Insomnia records each system change on disk before making it. When a session ends, it uses that journal to undo the changes, with a recovery agent available after a crash or quit.
  • Network recovery extras. Insomnia can join an iPhone hotspot after WiFi drops and can type continue into marked tmux panes after 90 seconds offline. Both behaviors require setup.

Who Insomnia is for

  • Developers running Claude Code, Codex, or similar coding agents who want a long task to continue after closing their MacBook lid.
  • Developers leaving timed agent work running unattended who want battery and heat thresholds rather than an unlimited stay awake switch.
  • Terminal heavy developers using marked tmux panes who want an agent nudged after a temporary network loss.
  • Mac developers willing to use an experimental open source utility and review its system permissions and recovery warnings before unattended sessions.

Similar micro SaaS ideas you can build

  • Render guard for freelance video editors. A Mac utility that keeps long exports and renders alive after the editor closes the laptop, then ends the session on low battery or dangerous heat and restores temporary power settings afterward.
  • Shoot backup runner for photographers. A post shoot tool that keeps checksum, backup, and cloud upload jobs running while a photographer packs up or travels, with recovery after brief network drops and a clear stop condition once the transfer window ends.
  • Local data pipeline watchdog. A lightweight guard for analysts and researchers running long imports, transformations, or model jobs on a laptop. It keeps the machine available only for the job window, watches battery and thermal limits, and cleans up system changes when the run is over.
Frequently asked

Insomnia FAQ

What Mac does Insomnia require?−
Insomnia requires macOS 26 or later on an Apple silicon Mac. Release builds are arm64 only.
Does it keep working when the MacBook lid is closed?−
Yes. During an active session, the timer keeps counting and coding agents can continue running with the lid closed.
What happens when the battery gets low?−
By default, Insomnia turns on Low Power Mode below 40 percent battery and ends the session below 10 percent. Both thresholds can be changed in Settings.
Can it recover after the app crashes?−
A recovery agent can attempt to undo journaled changes after the session end time if the app crashes or quits. Recovery is not guaranteed, and unresolved recovery warnings should be handled before leaving the Mac unattended.
Is Insomnia considered safe for unattended use?−
Insomnia is explicitly experimental. Recovery can fail and a running timer is not a safety guarantee. The documentation recommends keeping the Mac on a stable, ventilated surface rather than inside a closed bag.