I've tried all of:
sudo chown -R $USER /usr/local
sudo chown -R :admin /usr/local
sudo chown -R `whoami` /usr/local
sudo chmod -R 777 /usr/local
sudo find /usr/local -perm -200 -exec chmod g+w '{}' \+
And still /usr/local seems to be unwriteable to homebrew installs. For example:
/usr/local master
❯ brew update
Already up-to-date.
/usr/local master
❯ brew install fontconfig
==> Downloading https://homebrew.bintray.com/bottles/fontconfig-2.11.1.yosemite.
######################################################################## 100.0%
==> Pouring fontconfig-2.11.1.yosemite.bottle.3.tar.gz
Error: Permission denied - /usr/local/etc/fonts/conf.d/10-scale-bitmap-fonts.conf
I am tearing my hair out searching forums and like-questions and finding no resolution to this. I even tried different shells, such is the degree of my frustration. Especially given the permissions:
❯ ls -lad /usr/local/etc/fonts/conf.d/10-scale-bitmap-fonts.conf
-rwxrwxrwx@ 1 centzon admin 1.9K May 5 14:33 /usr/local/etc/fonts/conf.d/10-scale-bitmap-fonts.conf
The accepted answer here brew install - permission denied (after chown -R `whoami` ) did not work for me on Yosemite 10.10.3