Giving myself permissions in /etc/sudoers does nothing

I want to give myself permissions to use pmset without using sudo.

I added this line to etc/sudoers:

myname          ALL = /usr/bin/pmset

But when I save and close with :wq and run pmset, I get:

$ pmset -b disablesleep 1
'pmset' must be run as root...

What is it I'm doing wrong?


The sudoers file only gets read by sudo so you still need to run

sudo pmset ...

to execute the command. What your addition to sudoers does is that every user on your Mac can now execute pmset without entering a password (or even be in the admin group).

If you want to avoid having to type sudo pmset each time define an alias

alias pmset="sudo /usr/bin/pmset"