Hombrew installs packages in
/usr/local and it is advisable not to change that directory as it might break some dependencies and the packages that are installed, as they are pre-compiled.
Standard users might not have permissions to read and write
/usr/local, creating issues when using
brew install .
Being a Standard user and using brew to install a program
brew install <program>
the following error showed up:
To avoid the ownership/permission error, make the standard user an admin user.
Firstly, check if the user already belongs to the Admin group. To check this, the following command in the terminal will list all the groups the user belongs to:
dscacheutil -q group | grep -C 3 <username>
If Admin is not in the list of groups, it means that <username> is not part of it yet and it needs to be added.
A user that has Admin permissions could include the user name to the Admin group running the following command:
sudo dscl . -append /Groups/admin GroupMembership <username>
The line above is a command line shortcut of navigating to User Group Preferences > username > enable Allow user to administer this computer.
Although the user is now an Admin, you might still get permission errors as the settings to access the
/usr/local folders also need to be amended.
To give permissions to the new Admin User to use Hombrew, run the following command:
sudo chown -R $(whoami) $(brew --prefix)/*
Make sure you are in the new Admin User session when running this command.
How to Make Yourself an Administrator From the Terminal on a Mac
User permissions on the Mac OS X operating system determine whether a user can perform certain operations, like…