Fixing Homebrew "Permission denied" issues
When installing your first formula, Homebrew may complain about not being able to access certain directories. The easiest solution to this is:
chown <username> /usr/local/Cellar /usr/local/share # create these directories if they do not exist
Then sudo brew install abc
and you're going.