☾ SleepToggle · how it works
How SleepToggle works
You're being asked to pipe a script into bash and type your sudo password. Here is the complete list of what that does — and why it's built this way.
The app itself
SleepToggle is a single Swift file — about 100 lines, AppKit only, no dependencies: read it here. It puts an icon in the menu bar (☾ normal sleep, ☕ sleep disabled), and clicking the menu item runs one of two commands:
sudo pmset -a disablesleep 1 # ☕ stay awake, even with the lid closed
sudo pmset -a disablesleep 0 # ☾ normal sleep
The icon re-reads the real state from pmset -g every time you open the menu and once a minute, so it stays truthful even if you change the setting from Terminal. Why this setting beats the usual approach is covered in lid-closed sleep, explained.
Everything the installer touches
~/Applications/SleepToggle.app— the installer downloads the source and compiles it on your Mac with Apple's own tools. There is no prebuilt binary: what runs is exactly what you can read, and a locally-built app needs no App Store, no code signing and no Gatekeeper exceptions./etc/sudoers.d/pmset-disablesleep— one line letting your user run exactlypmset -a disablesleep 1andpmset -a disablesleep 0without a password. Nothing else gains sudo. This is the only reason the installer asks for your password, and the rule is validated withvisudobefore it's installed.~/Library/LaunchAgents/com.sleeptoggle.plist— starts the app at login. macOS shows its standard "can run in the background" notice once; you can manage it in System Settings → Login Items.
Requirements: macOS 11 or newer, and Apple's Command Line Tools (the installer opens Apple's own dialog if they're missing).
What it doesn't do
- No telemetry. The app makes no network requests — you can confirm that in the source. The website keeps ordinary anonymized server logs, nothing more.
- No accounts, no updates, no background helper. It's a button.
- No warranty. MIT licensed. Worth repeating: ☕ means a closed MacBook in a bag keeps running and gets warm, and the setting persists across reboots — the always-visible icon exists so you notice.
Uninstall
curl -fsSL https://sleep.138.dk/uninstall.sh | bash
Removes all three pieces above and re-enables normal sleep. Read it first if you like. Nothing is left behind.