I do most of the "work" I do on my Mac as a Standard
user (Apple parlance for an unprivileged user). I also frequently use the CLI (zsh
mostly now) via the Terminal
app. I use MacPorts as a package manager, and various utilities such as find
, rsync
, launchctl
, ip
, mount
, log
, softwareupdate
, etc etc etc. As it frequently happens, something I am trying to do from the CLI requires privilege elevation via the sudo
command.
However: According to this document, it seems that Apple does not support the use of sudo
by Standard
users:
Only administrator users can use sudo. If you’re not logged in as an administrator, you can do so by entering the following command, where adminUsername is the name of an administrator user:
% su adminUsername
This seems clumsy and inconvenient: su
and then sudo
. It is also at odds with the way sudo
works on other platforms I use. Of course macOS requires Admin user authentication to perform some tasks in the GUI, but this is generally not the way that sudo
operates; i.e. any user may be granted privileges to perform specified tasks by the Admin user for the system.
I won't ask "why" Apple does it this way as that can only be an opinion here, but I will ask if there is a work-around - can sudo
on macOS be made to work as it does on other platforms?