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.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for krishhgg/Insomnia and "Keep a MacBook awake for a timed agent run"
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer