Install
Install scripts require and verify each release's SHA256SUMS.txt. A missing,
malformed, or mismatched checksum stops installation.
Install script (macOS/Linux)
Installs to ~/.local/bin, override with --install-dir:
curl -fsSL https://raw.githubusercontent.com/niklasfp/nightowl/main/install.sh | sh
curl -fsSL https://raw.githubusercontent.com/niklasfp/nightowl/main/install.sh | sh -s -- --install-dir ~/bin
Install script (Windows PowerShell)
Installs to %LOCALAPPDATA%\Programs\NightOwl and adds it to your user
PATH:
irm https://raw.githubusercontent.com/niklasfp/nightowl/main/install.ps1 | iex
Manual download
No runtime needed — download the archive for your platform from the
GitHub Releases page, unpack,
and run nightowl:
Portable .NET tool (alternative)
If you already use the .NET SDK, NightOwl is also published as a dotnet tool on
GitHub Packages. Requires the .NET 10 runtime; add the feed once
(authenticate with a GitHub token that has read:packages), then install:
dotnet nuget add source "https://nuget.pkg.github.com/niklasfp/index.json" \
--name github --username <you> --password <GH_TOKEN> --store-password-in-clear-text
dotnet tool install -g NightOwl --add-source github
nightowl --version
Publishing to nuget.org is planned —
once live, this
becomes a single dotnet tool install -g NightOwl with no feed setup.
Update
Re-run the same install command for the method you used:
- Install script (macOS/Linux) — re-run
curl -fsSL https://raw.githubusercontent.com/niklasfp/nightowl/main/install.sh | sh(fetches the latest release and replaces the binary in place; pass your--install-diragain if you overrode it). - Install script (Windows) — re-run
irm https://raw.githubusercontent.com/niklasfp/nightowl/main/install.ps1 | iex. - Manual download — download the new archive and replace the unpacked binary.
- Portable .NET tool —
dotnet tool update -g NightOwl --add-source github.
Uninstall
- Install script (macOS/Linux) —
curl -fsSL https://raw.githubusercontent.com/niklasfp/nightowl/main/install.sh | sh -s -- --uninstall(or justrm ~/.local/bin/nightowl; use your--install-dirif you overrode it). - Install script (Windows) —
& ([scriptblock]::Create((irm https://raw.githubusercontent.com/niklasfp/nightowl/main/install.ps1))) -Uninstall(also removes the PATH entry it added). - Manual download — delete the unpacked
nightowlbinary (and revert any PATH edit you made yourself). - Portable .NET tool —
dotnet tool uninstall -g NightOwl.
Usage
nightowl [options] [-- <command> [args...]]
(no args) Keep the system awake until Ctrl+C
-t, --for <duration> Keep awake for a duration, then exit (e.g. 30s, 90m, 2h, 1h30m)
-w, --pid <pid> Keep awake while process <pid> runs; exit 0 when it does
-- <command> [args] Keep awake while <command> runs; exit with its exit code
-d, --display Also keep the display awake (not just the system)
-s, --block-sleep Block system sleep as strongly as the platform allows
-v, --verbose Log which backend/assertion is used
-q, --quiet Don't print the status line on start
-h, --help Show help
--version Show version
nightowl # stay awake until you press Ctrl+C
nightowl --for 90m # stay awake for 90 minutes, then exit
nightowl --display --for 1h # keep the screen on for an hour too
nightowl -- ./long-build.sh # stay awake while the build runs; exit with its code
nightowl --block-sleep --for 2h # also block system sleep (not just idle), for 2 hours
nightowl --pid 4821 # stay awake while an existing process (PID 4821) runs
--for, --pid, and a wrapped -- <command> are mutually
exclusive, as are --quiet and --verbose. Unknown options exit with code 2.
--pid is the caffeinate -w equivalent: it holds the inhibitor while an
existing process runs. It fails fast — a distinct error, non-zero exit, no lock taken — if the
PID doesn't exist at startup, and identity is only checked then: a PID recycled by the OS
afterward is indistinguishable from the original.
Platforms
| Platform | Mechanism |
|---|---|
| Windows | PowerCreateRequest/PowerSetRequest(SystemRequired [+ DisplayRequired] [+ ExecutionRequired]) with a REASON_CONTEXT reason string |
| macOS | IOKit power assertions — IOPMAssertionCreateWithName(PreventUserIdleSystemSleep [+ PreventUserIdleDisplaySleep] [+ PreventSystemSleep]) |
| Linux | logind Inhibit fd over D-Bus via libsystemd (falls back to systemd-inhibit … cat, tied to NightOwl's lifetime) |