MacOS – Chown to make sudo unncessary

command linemacospermissionroot

I am setting up a new Mac for mobile app development and so I need to install a lot of things through the Terminal. Its asking me for sudo to do a lot of things and I vaguely remember a chown command that makes my user the owner of the root directory so that I don't need to do sudo. What is that command?

(Most of my searches so far have taken me to people messing up that command and breaking things and so I didn't just want to try something.)

Best Answer

The tool chown isn’t good for this. Instead use sudo -s to be root. Now you’re the owner of the root directory.

If you want to ask a follow on question showing a specific path and specific command you get a specific error, there might be a better way to set things up - root won’t help with system read only files and the restricted flag in System Integrity Protection. Also, avoiding root entirely or adding your user to the sudoers file for the things you need also will get you less friction without tearing down all the protections of using a non-root user provide.