Just lately I’ve needed to make some adjustments on my Macbook that required me to not solely have simply sudo privileges however root privileges. Once I searched how to do that the reply which appeared most applicable for me was to run the instructions I wanted to run with root privileges in AppleScript utilizing “with administrator privileges” after the shell script I wished to run. This achieved what I wanted to do, however generally I would like to not have to make use of AppleScript after I wish to run just a few instructions within the shell.
Due to this fact, I used to be questioning what the shell model of “with administrator privileges” is that might work for my mac. I’m searching for one thing that would supply me with not solely sudo privileges however root privileges as effectively. I would like it if I may do that in a means that was “sh-compatible” so it will work on zsh, bash, and so on. However, I’d additionally settle for an answer that solely works with zsh (my interactive shell of selection) if there’s not an excellent “sh-compatible” answer for me.
I perceive that I can run AppleScripts within the terminal utilizing osascript in an analogous vein as the answer supplied in Methods to open a shell script in a brand new Terminal window and run it with administrator privileges however I hoped for a extra “pure sh” answer if potential.