MacBook lid-close sleep terminal workaround
This page documents an advanced terminal workaround for manually controlling MacBook lid-close sleep outside the Mac App Store version of Rouse.
The Mac App Store build cannot ship this as a feature because this workaround depends on administrator-level pmset power changes outside the normal App Sandbox boundary.
Quick commands
Add this function to your ~/.zshrc or another shell profile:
rouse() {
case "$1" in
on)
sudo pmset -a disablesleep 1
pmset -g | awk '/^[[:space:]]*SleepDisabled[[:space:]]/ { print "SleepDisabled =", $2 }'
;;
off)
sudo pmset -a disablesleep 0
pmset -g | awk '/^[[:space:]]*SleepDisabled[[:space:]]/ { print "SleepDisabled =", $2 }'
;;
status)
pmset -g | awk '/^[[:space:]]*SleepDisabled[[:space:]]/ { print "SleepDisabled =", $2 }'
;;
*)
echo "usage: rouse {on|off|status}"
return 1
;;
esac
}
Reload your shell, then use rouse on, rouse off, and rouse status.
What it actually does
rouse onrunssudo pmset -a disablesleep 1.rouse offrestores normal sleep withsudo pmset -a disablesleep 0.rouse statusprints the currentSleepDisabledstate in a readable format.- The intended use case here is MacBook lid-close sleep, not a generic desktop sleep toggle.
Because disablesleep=1 blocks both idle sleep and lid-close sleep, the Mac will also stay awake when left untouched on the desktop. Run rouse off as soon as you are done.
Boundaries
- This is an advanced terminal workaround, not a shipped product feature.
- It affects system sleep globally, not only lid-close sleep.
- It is separate from the Mac App Store version of Rouse.
- The Mac App Store build cannot include this path as a supported feature.
- The setting persists across restarts. If you forget to run
rouse off, your Mac will continue skipping idle sleep after reboot. - Prefer
rouse offas soon as you are done.
How to remove it
- If the current state still shows
SleepDisabled = 1, runrouse offfirst. If you already removed the function, you can runsudo pmset -a disablesleep 0directly. - Remove the
rouse()function from~/.zshrcor whichever shell profile you used, then reload your shell.
About this page
The Mac App Store version of Rouse stays within what the App Sandbox allows. This page documents the terminal-level workaround for advanced users who are comfortable changing system power settings. The rouse shell function shown on this page is a standalone helper that lives in your shell profile; it is not a command-line interface for the Mac App Store version of Rouse.