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

macosSecurity

I need some smart ideas for clever ways around mac security and online child safety issues. I'm not exactly sure how to word this question. Of course my 11 year old does not have full admin rights on his laptop, but this creates problems in downloading and running packages using homebrew, etc.

We're running into lots of rights access and sudo issues. I'm downloading packages on the admin account, then trying to get things working on his user account. We're trying to get rtl-433 up and running, and running into a ton of issues with different needed packages.

How can I give him semi admin rights to be able to download and install via the terminal so he do whatever dev he needs to, yet also maintain admin rights over other aspects, internet usage etc? Anyone know some tricks?

Specifically running into access rights issues with files in user/bin/local from his account.

Does this make sense?

If I give his account admin rights just to install stuff, and change it back once things are installed, I think we're still going to run into access issues, right? or not? Is this a potential way around it?

Otherwise, is there anything like some kind of virtual environment I can run, that gives some level of access to admin rights?

Best Answer

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).