# install-insomnia

Adopt this skill: https://proskills.md/skills/other/krishhgg-insomnia-skills-install-insomnia

Page: https://proskills.md/skills/other/krishhgg-insomnia-skills-install-insomnia
This document is the public skill bundle for that page. It contains SKILL.md and every helper file the catalog carries. No login is required.

## File: skills/install-insomnia/SKILL.md
size: 2465
sha: c5b6c068fb4be01b5ea7398dd8c865e30c4a2820
upstream: https://github.com/krishhgg/insomnia/blob/main/skills/install-insomnia/SKILL.md

```text
---
name: install-insomnia
description: Install or upgrade Insomnia, the macOS menu bar app that keeps a Mac awake for a timed session, from a GitHub release or from source. Use when the user asks to install, update or reinstall Insomnia.
---

# Install Insomnia

The exact commands are in
[docs/install.md](https://github.com/krishhgg/Insomnia/blob/main/docs/install.md).
Read that page, then follow these steps. Never run `sudo` yourself and never
pass a password to it. When a step needs the administrator password, give the
user the exact command to run in Terminal and wait for them to say it finished.

1. **Check the Mac.** Insomnia needs macOS 26 or later (`sw_vers -productVersion`).
   Release zips run only on Apple Silicon: `sysctl -n hw.optional.arm64` prints
   `1`. On an Intel Mac, use "Build from source" and tell the user that build is
   untested on Intel.
2. **Pick the channel.** Use the latest stable release unless the user asked
   for the newest nightly. If the release is `v0.1.0`, follow its release notes
   instead of docs/install.md.
3. **Download and verify.** Follow "Install a release yourself", steps 1 and
   2. Run both checks. Keep `--source-digest` and the full 40-character commit.
   If either check fails, stop and tell the user. Do not download a different
   file to get past it.
4. **Install.** Step 3 of the same section runs `install.sh`, which asks for
   the administrator password, so hand that command to the user. Before they
   run it, tell them the installer adds a sudoers rule. That rule lets their
   account run four `pmset` power commands without a password, and the page's
   "What gets installed" section lists them. `--allow-unverified-origin`
   tells the installer that both download checks passed. Never suggest it
   when they did not.
5. **First launch.** macOS blocks the first launch of a downloaded app until
   the user allows it in System Settings > Privacy & Security.
6. **Confirm.** The eye shows in the menu bar, and
   `launchctl print gui/$(id -u)/com.insomnia.backstop` finds the recovery
   agent. Ask the user to review the lid-close options in Settings before the
   first session.

An upgrade is the same steps. The installer asks the running app to quit and
stops if a session is still waiting to be undone. Then use the
maintain-insomnia skill to find out why.

To build from source, follow "Build from source" on the same page. Its
`./scripts/install.sh` also needs the password.
```

## File: README.md
upstream: https://github.com/krishhgg/insomnia/blob/main/README.md

````text
<p align="center">
  <img src="docs/assets/eye-open.svg" alt="Insomnia: an open eye with a round pupil and five lashes above it" width="112">
</p>

<h1 align="center">Insomnia</h1>

<p align="center">
  <strong>Keep your Mac awake. Give the session an end time.</strong>
</p>

<p align="center">
  A macOS menu bar app for timed awake sessions. Insomnia is an eye icon that
  lives in your MacBook menu bar. It has no Dock icon and no main window. Set
  how long your Mac stays awake, choose what happens when the lid closes, and
  see when something could not be undone.
</p>

<p align="center">
  <a href="https://getinsomnia.app"><strong>Website</strong></a> ·
  <a href="#install"><strong>Install</strong></a> ·
  <a href="#using-it"><strong>Using it</strong></a> ·
  <a href="#what-happens-when-the-lid-closes"><strong>Lid close</strong></a> ·
  <a href="#how-recovery-works"><strong>Recovery</strong></a> ·
  <a href="SECURITY.md"><strong>Security</strong></a>
</p>

<p align="center">
  <a href="LICENSE"><img alt="MIT license" src="https://img.shields.io/badge/License-MIT-536D78?style=flat-square"></a>
  <img alt="macOS 26 or later" src="https://img.shields.io/badge/macOS-26%2B-303336?style=flat-square">
  <img alt="Experimental source build" src="https://img.shields.io/badge/Status-experimental-536D78?style=flat-square">
</p>

> **Use a stable, well-ventilated surface, not a closed bag.** Insomnia is
> experimental. Recovery can fail, and a running timer is not a safety
> guarantee.
> [Validation status](docs/release-validation.md) · [Apple's ventilation guidance](https://support.apple.com/en-us/102336)

<p align="center">
  <img src="docs/assets/session-flow.svg" alt="Illustrated menu-bar controls: enter Days, Hours, and Minutes, watch the countdown, and hold the end control to finish early. Click the eye or countdown to add time. Closing the lid is optional, and incomplete recovery needs attention." width="880">
</p>

## Install

Requires macOS 26 or later on an Apple Silicon Mac.

Paste this into your coding agent:

```text
Install the latest stable Insomnia release by following https://github.com/krishhgg/Insomnia/blob/main/skills/install-insomnia/SKILL.md. If a step needs my password, give me the command to run in Terminal.
```

For the newest nightly, write "the newest Insomnia nightly prerelease" in
place of "the latest stable Insomnia release". Nightlies are built from `main`
on each day it has new commits. They have the newest code and may be broken.

To install a release yourself, follow [docs/install.md](docs/install.md). It
covers both channels, how to check the download, and `v0.1.0`, which installs
differently. Settings > General shows the installed version, and "Check for
updates" there tells you whether a newer release exists without installing
anything.

### Build from source

Needs Xcode with Swift 6.2 or later. Replace `v<version>` with the latest
stable tag, or a nightly tag for the newest code:

```bash
git clone --branch v<version> --depth 1 https://github.com/krishhgg/Insomnia.git
cd Insomnia
./scripts/install.sh
open "$HOME/Applications/Insomnia.app"
```

<details>
<summary><strong>What the installer changes on your Mac</strong></summary>

The installer needs your password, because the sudoers rule is a system
file. It installs:

- The app, at `~/Applications/Insomnia.app`.
- A **recovery agent**, a `launchd` job that runs every minute. If the app is
  gone when a session should have ended, the agent tries to undo the
  session's changes.
- A **sudoers rule** at `/etc/sudoers.d/insomnia`. A sudoers rule decides who
  can run what with `sudo`. This one lets your user account, not just
  Insomnia, run these four commands without a password:

```text
/usr/bin/pmset -a disablesleep 1
/usr/bin/pmset -a disablesleep 0
/usr/bin/pmset -b lowpowermode 1
/usr/bin/pmset -b lowpowermode 0
```

Any program running as you can use that rule too, so review it before you
install. [docs/install.md](docs/install.md#what-gets-installed) lists every
file and explains how upgrades replace them.

</details>

## Using it

1. **Start.** Click the eye in the menu bar, enter days, hours and minutes,
   and press Enter.
2. **Add time.** Click the eye or the countdown during a session.
3. **End early.** Press and hold the end control next to the countdown, or
   right-click the menu bar item and choose **End session**.
   To show only the eye, turn off "Show the countdown in the menu bar" in
   Settings. The eye opens while a session runs and closes when it ends,
   and the right-click menu also shows the time left.
4. **Settings and status.** Right-click the eye. Quit asks Insomnia to undo
   the session first, and it refuses while a change is still waiting to be
   undone. Saved audio for an output that isn't connected doesn't hold it up.
   Insomnia restores that output if it reconnects while the app runs, or at
   the next launch.
5. **Menu bar style.** The Menu bar picker in Settings > General has four
   styles. Pills, the default, works as described above. Compact keeps only
   the eye in the bar, and a click opens the same pills, countdown and end
   ring in a small panel. Minimal is the eye with a ring for the time left:
   a click adds the default session length, and a 0.6 s hold ends the
   session. Popover shows the eye and, during a session, the time left to
   the minute (or the end time). Any click on it, left or right, opens a
   popover with time buttons, Custom fields for days, hours and minutes,
   the status, Settings and Quit. While a session runs it also has the
   ring you hold to end it. Popover style has no right-click menu, since
   the popover shows the same things.
6. **One click.** Turn on "Start a session with one click" in Settings >
   General, under the Menu bar picker. Then, in Pills, Compact and Popover,
   a click on the eye with no session running starts the default session
   length. Option-click opens the usual controls to pick another length,
   and in Popover a right-click or Control-click does too. A click during a
   session works as it does with the switch off, and never ends the
   session. If the start is refused, the pills, the panel or the popover
   opens with the reason. Minimal already adds the default length on every
   click, so Settings greys the switch out there. It is off by default.
7. **Sounds.** "Play a sound when you start or end a session" in Settings >
   General plays a short tone when you start or end a session from the
   menu bar. It is off by default, and while it is off Insomnia makes no
   sound and loads none. A session that ends without you asking (the
   timer, the recovery agent, Quit, a battery or heat rule, recovery after
   a crash) makes no sound. Nothing plays while the displays sleep or the
   lid is closed, and `--session` commands make no sound.
8. **From a script or an agent.** The app's binary drives the running app:

   ```bash
   INSOMNIA=~/Applications/Insomnia.app/Contents/MacOS/Insomnia
   "$INSOMNIA" --session start 7200    # two hours
   "$INSOMNIA" --session extend 1800
   "$INSOMNIA" --session status
   "$INSOMNIA" --session end
   ```

   It starts, extends and ends the same session the menu bar counts down,
   with the same battery and heat rules, and prints one line. It changes
   nothing itself, so when the app isn't running it says so and exits 1.
   A build without this mode opens the menu bar app instead, so a script
   that may meet one checks `InsomniaSessionCommandVersion` in the bundle's
   `Info.plist` first.

You don't have to close the lid, and opening it doesn't end the session.
When the timer or a battery or heat rule ends a session with the lid closed,
Insomnia puts the Mac to sleep.

Insomnia stops system sleep, not display sleep, so the display still turns off
when idle. If your Mac then asks for a password, agents that drive the screen
stop at the lock screen. **Keep the screen on and unlocked** in Settings >
General holds the display awake during a 
````
