Doorstopper is a Raycast extension which prevents your MacBook from going to sleep when you close the lid.
Note:
The underlying commands need to be run withsudoprivileges.
The extension will prompt you for your password by default, or you can set up passwordless mode once.
Doorstopper can use Touch ID instead of a password when Touch ID authentication is enabled for sudo. This changes sudo authentication globally, not just within Raycast.
/etc/pam.d/sudo_local.template to /etc/pam.d/sudo_local:
sudo cp /etc/pam.d/sudo_local.template /etc/pam.d/sudo_local
/etc/pam.d/sudo_local:
auth sufficient pam_tid.so
Add the following line to the auth entries in /etc/pam.d/sudo:
auth sufficient pam_tid.so
Changes to /etc/pam.d/sudo can be overwritten by macOS updates. If Touch ID is unavailable or not enabled for sudo, Doorstopper will continue to use the administrator password prompt.
Run Set up Passwordless Doorstopper to install a sudoers rule for your macOS account at /etc/sudoers.d/raycast-doorstopper-<username>. Each account on the Mac gets its own rule file. macOS asks for your admin password once. The rule lets your user run only these two commands as root without a password:
/usr/bin/pmset -a disablesleep 0
/usr/bin/pmset -a disablesleep 1
With the rule installed:
Run the same command again to remove the rule.
To install the Doorstopper extension, follow these steps:
Once installed, simply trigger the Raycast command palette and search for the Doorstopper commands.
Enable DoorstopperThis command will enable Doorstopper, preventing your MacBook from sleeping when the lid is closed.
Disable DoorstopperThis command will disable Doorstopper, allowing your MacBook to sleep when the lid is closed.
Toggle DoorstopperThis command will toggle the Doorstopper status between enabled and disabled.
Doorstopper StatusThis command will show the current status of Doorstopper (enabled or disabled).
Doorstopper Status Menu BarThis command will show the current status of Doorstopper in the menu bar, with the time left on a timer. It checks every minute and disables Doorstopper when a timer ends, the battery is low, or the Mac restarted. From the menu you can enable Doorstopper for a preset, recent or custom duration.
Enable Doorstopper for DurationPick how long to keep the MacBook awake with the lid closed: 30 minutes, 1, 2 or 4 hours, or indefinitely. Type a duration such as 45m, 1h30, 2.5h or 1:30 (up to 7 days) to use your own. Timers need passwordless mode.
Set up Passwordless DoorstopperInstalls or removes the passwordless rule described above.