SleepOff is a small macOS menu bar app for one specific job:
- keep your Mac awake when the lid is closed
- force the built-in display brightness to
0only while the lid is closed - restore brightness when the lid opens again
It lives in the menu bar, uses a simple sun / moon state, and avoids repeated password prompts by installing a narrow one-time privilege rule for pmset.
- click the menu bar icon to toggle SleepOff on or off
- long press the menu bar icon to open a small menu with
Change Shortcut…andQuit - right click or
Option-click also opens the menu - adds a global toggle shortcut, defaulting to
Control + Command + S - prevents sleep with
pmset -a disablesleep - reads lid state from
AppleClamshellState - drops brightness to
0only on lid close - restores brightness only when SleepOff actually forced it to
0 - installs a one-time
sudoersrule so future toggles stay quiet
This started as a tiny shell-command workaround and turned into a menu bar app so the behavior is always one click away.
brew tap sabraman/sleepoff
brew install --cask sleepoffUpgrade later with:
brew upgrade --cask sleepoffThere is also a small Darwin-only flake for people who already use Nix:
nix run --extra-experimental-features 'nix-command flakes' github:sabraman/sleepoffOr build the app bundle output:
nix build --extra-experimental-features 'nix-command flakes' github:sabraman/sleepoffThis is intentionally lightweight and is not being pushed into nixpkgs right now.
curl -fsSL https://raw.githubusercontent.com/sabraman/sleepoff/main/scripts/install-release.sh | shThis will:
- download the latest release zip
- install
SleepOff.appto~/Applications - install the LaunchAgent
- start the app
./scripts/install.shThis will:
- build
SleepOff.app - copy it to
~/Applications/SleepOff.app - install
~/Library/LaunchAgents/local.sleepoff.menubar.plist - start the menu bar app
Each GitHub release ships with:
.zipBest for Homebrew and scripted installs.dmgBest for manual downloads
The .dmg opens as a drag-to-Applications window.
macOS requires admin privileges for:
pmset -a disablesleep 1
pmset -a disablesleep 0SleepOff handles that by installing a one-time sudoers rule limited to those exact commands. After the first approval, later toggles should not keep asking for a password.
- click the menu bar icon to toggle SleepOff immediately
- long press the menu bar icon to open the context menu
- right click or
Option-click also opens the context menu - use
Control + Command + Sto toggle from the keyboard - change the shortcut from the long-press menu
SleepOff is distributed unsigned on purpose.
This project is intentionally lightweight and does not rely on a paid Apple Developer account just to notarize a tiny personal utility.
If macOS blocks the app, see docs/UNSIGNED_APP.md.
- closed-lid awake mode can create heat
- do not use it in a bag
- do not leave it on soft surfaces like blankets or pillows
- behavior may vary across macOS versions and MacBook models
Main pieces:
- SleepOffMenuBar.swift
- install_sleepoff_privileges.sh
- build.sh
- install.sh
- install-release.sh
- release.sh
- sleepoff.rb
- sleepoff-icon.svg
- app repo: github.com/sabraman/sleepoff
- tap repo: github.com/sabraman/homebrew-sleepoff
Build the app:
./scripts/build.shFor Nix users:
nix develop --extra-experimental-features 'nix-command flakes'Build release artifacts:
./scripts/release.shThat creates:
dist/SleepOff-<version>-macos.zipdist/SleepOff-<version>.dmg