lightsout
Asks every open app to quit, keeping your terminal open.
In their words
lightsout is a free, open-source command for macOS, Linux and Windows. One command asks every open app to quit, the same way as Cmd+Q or the close button, and keeps the terminal it runs from open.
How it handles unsaved work
Apps receive the same request as a manual quit, so they can ask you to save. Apps still open after the timeout are listed at the end, never killed.
Controls
-
A dry-run option lists the apps it would ask to quit and quits nothing.
-
keep and unkeep manage a config file of apps to leave open.
-
With the yes option it never stops to ask, and it quits nothing if it cannot tell which app it runs from.
Platforms
macOS: apps in the Dock, then Finder windows. Linux: apps with open windows, through wmctrl on X11. Windows: taskbar apps, then File Explorer windows.
Installs through Homebrew, Scoop, .deb, .rpm or go install. Release checksums are signed with cosign.
Fact file
Developer tool- Command line
- macOS
- Linux
- Windows
- Homebrew
- Scoop
- wmctrl
- xprop
- cosign
- Exit status
- 1 when apps are still open
- Completion
- bash, zsh, fish, PowerShell
- Timeout
- 1 to 300 seconds
- Go build
- Go 1.26 or newer
What is lightsout?
One command asks every open app on a Mac, Linux or Windows machine to quit. The request is the same one sent by Cmd+Q or the close button, so an app can show its save prompt and wait. Apps still open after the timeout are listed at the end, and nothing is force-quit.
Which apps it closes on each platform
lightsout works in each system's own way. On macOS, it targets apps in the Dock by process ID, then closes Finder windows. On Linux, it asks apps with open windows to close through wmctrl on X11. On Windows, it closes taskbar apps through WM_CLOSE, then File Explorer windows. The terminal it runs from stays open. The page says lightsout works out which app that is in Terminal, iTerm2, VS Code and Windows Terminal. Over SSH or inside tmux it cannot tell, so it asks which app you are running it from, with 0 for none of the listed apps.
Dry runs, keep lists and a safe scheduled mode
The dry run option prints the apps it would ask to quit and quits nothing. The keep and unkeep commands edit a config file at ~/.config/lightsout/config.yml, and a name passed on the command line keeps an app for one run only. With the yes option it never stops to ask, and if it cannot identify the calling app it quits nothing. The timeout setting accepts whole seconds from 1 to 300. The page gives a cron example that runs at 7 pm on weekdays with a 30 second timeout. The command exits with status 1 when any app is still open, so scripts can tell.
Install options and release checks
Install with Homebrew, Scoop, a .deb or .rpm package, or go install on any system with Go 1.26 or newer, which builds from source. The Linux packages pull in wmctrl and xprop. Release checksums are signed with cosign, build provenance can be checked with gh attestation verify, and SBOMs ship with every download. The project is scanned by CodeQL, govulncheck and OpenSSF Scorecard. Tab completion covers bash, zsh, fish and PowerShell, and a man page comes with the package.