brew is configured in a way that only the user who installed it is able to make changes to it. In this guide we’ll go through the process to change
brew permissions, so that, every admin user on macOS can make changes to brew or its installed packages. This process can be modified to allow non-admin users the same permissions but that is not recommended.
Make sure that you’re an admin:
The first thing we need to make sure is that your user is an “Admin” in macOS. There are two ways to check if you’re an admin or not.
The first one is to check in System Preferences > Users & Groups, like what follows:
Another way to do this is to run the following command in your terminal:
echo $(groups $(whoami)) and see if the returned list contains “admin” in it.
Change the directory permissions:
The following command will transfer the ownership of
brew installation directory to admin group:
sudo chgrp -R admin $(brew --prefix).
And just to make sure:
sudo chgrp -R admin $(brew --prefix)/Cellar
And now we can make the
brew installation directory recursively writable by all users who are in the admin group:
sudo chmod -R g+rwX $(brew --prefix).
And again to make sure
sudo chmod -R g+rwX $(brew --prefix)/Cellar
And that is it. Now any admin user will be able to make changes to