Credentials. The installed sudoers rule lets any program running as your user account run the pmset power commands without a password, so review /etc/sudoers.d/insomnia before you install.
Who it is forA developer who starts a long coding agent task on a MacBook and needs it to keep running after they close the lid and walk away.
The problemmacOS sleeps the laptop when the lid closes, which stops a long task and can leave work unfinished.
The outcomeThe Mac stays awake until the session end time, the lid-close actions are applied, and the session's changes are undone when it ends.
What you need first
- A Mac with Apple Silicon running macOS 26 or later
- Your administrator password, because the installer adds a sudoers rule
- Terminal access, and optionally Xcode with Swift 6.2 or later if you build from source
- A stable, well-ventilated surface for the Mac during a session, as the README advises
Steps
- Paste the install prompt from the README into your coding agent, or follow docs/install.md, and enter your password in Terminal when asked.
- Run
open "$HOME/Applications/Insomnia.app"to start the app. - Click the eye in the menu bar, enter days, hours and minutes, and press Enter to start the session.
- Check Settings, including the lid-close options, before you close the lid.
- Read
~/Library/Logs/Insomnia/insomnia.logafter the first session to confirm what happened.
Prompt for your agent
Using the repo https://github.com/krishhgg/Insomnia, install Insomnia on this Mac by following skills/install-insomnia/SKILL.md, and if a step needs my password, give me the exact Terminal command to run. Then start a session of <session-length> from the menu bar eye. Verify that ~/Applications/Insomnia.app exists and report the installed version from Settings > App.
Caveat. Insomnia is described as experimental, the timer is not a safety guarantee, and the battery and heat rules only work while the app is running.
Get 5 new use cases every morning. Free, one short email, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Disclaimer
Deduped lists open-source repositories that belong to other people. We do not own, maintain, audit, or vouch for any of them, and a repo appearing here is not an endorsement or a safety check. The use cases, steps, and prompts are written by AI and may be incomplete, outdated, or just wrong. Where a use case is marked "Seen in the wild", we link to public posts where someone described something similar, but we have not verified those posts and the use case itself is still our AI's own write-up. Use all of this at your own risk. Only run code, commands, or agents on systems and accounts you are authorized to use, and read the code and every command before you run it, especially anything that touches credentials, files, or the network. Nothing here is professional, security, legal, or financial advice. All trademarks and project names belong to their respective owners, and their use here does not imply affiliation. Content is provided as is, without warranties of any kind. Found a mistake, a safety problem, or something you want removed? Email [email protected] and we will look at it promptly. Full disclaimer page