I use my Mac daily with a non admin user account. When updating brew I open terminal and “su admin” to log into my admin account—then run brew update and upgrade.
Recently, when trying to un-install a package that required login permissions I was blocked by MacOS because I didn’t have access/permission in Security Preferences. The option to give access never appeared. This was because I was still logged into my user account —not my admin account. I had to log out of my user account and into my admin account to run that uninstall command to get the access prompt from Security Preferences.
The question is would it be better, or solve that issue to use “su admin -u” instead of just “su admin” when running brew in my non admin user account?
I tried logging in that way and received a warning:
$ su admin -u
bash: HOMEBREWDIR: unbound variable