Changing Ownership of a directory in OS X
On my system, /usr/local
is owned by root:admin
and is rwxrwxr-x
. My user is a member of the admin
group, thus has write permissions. I haven't messed with ownership and permissions there, and my Homebrew installation is not complaining, so I assume my setup fits its requirements.
Check the ownership of your /usr/local
; if it is owned by group admin
, check if your non-adminsitrator account is a member of that group.
Simple solution that worked for me:
- click on your background to go to finder
- click on go and go to folder /usr
- right click on local and do get info
- unlock the lock at the bottom
- click + sign and add your user to the list and give read/write privileges
- click on the gear sign at the bottom and choose apply to enclosed items to recurse under that directory and assign privileges too all directories beneath it.
type brew doctor
from command prompt to test. My result:
Your system is ready to brew.
You should use: sudo chown username folder
Be careful with the change of ownership
Do not try to change ownership for /usr/
or recursively for /usr/local/
if you are not getting the same error posted in the original question.
You could screw up your system or weakness its security.
Some users can receive with homebrew permission errors that could be solved without changing the ownership of the whole /usr/
or /usr/local/
directories.
According to my experience, in most cases, it is just enough to restore the ownership for /usr/local/Cellar
:
sudo chown -R "$USER" /usr/local/Cellar/
Alternatively, if you have a not standard installation
sudo chown -R "$USER" "$(brew --prefix)/Cellar"