How to give enough access so a child can use the terminal, download packages, yet does not have full admin rights on mac?

Solution 1:

You can give admin access to specific commands using sudo. To do so, log in as an admin user, open Terminal and run EDITOR=nano sudo visudo /etc/sudoers.d/myconfig (which will create a new file and open in nano). Then add the following line (replace KID with the name of the unix account of your kid, ADMIN with the account name of the user which installed brew)

KID ALL = (ADMIN) /usr/local/bin/brew

He should then be able to run brew commands by typing sudo brew ... and entering his password.

To allow commands to be run as root (things you already run with sudo even from an admin account) use

KID ALL = /path/to/command

(obviuosly this has some risks).