Absolutely disgusting. But what can we do about it?
You can type the following in your shell:
This will keep your Macbook awake, even in clamshell mode, until you disable it by typing:
But typing in those two commands over and over is a tremendous drag. Let’s automate it!
We can’t automate jack shit if we’re constantly being queried for a password every time the command runs. Every time you use sudo in the Terminal, you are attempting to run a process as “root user” and will be queried for an admin password. Therefore, we are going to selectively nuke that security feature just for pmset and just for your account.
Allow your user to run sudo pmset with no password auth:
> whoami to get your username. For me, that’s aidangibson.
> sudo visudo -f /etc/sudoers.d/sudoers create new sudoers file
aidangibson ALL = (root) NOPASSWD: /usr/bin/pmset Type this in exactly (obviously replacing my username with yours). Fucking up sudoers can absolutely fuck up your computer, which is why we’re not editing the sudoers file directly, instead using visudo.
The general format for this is <username> ALL = (ALL) NOPASSWD: /path/to/program. You can also modify this file to allow you to use sudo with no password for all programs. But that’s incredibly stupid and I won’t tell you how to do it.