Can't install Brew formulae correctly (Permission denied in /usr/local/lib)
Solution 1:
As of writing, Homebrew requires the contents of /usr/local to be chown'd to your username. This doesn't seem like a great solution, but it works, and is evidently the recommended use. See: https://github.com/mxcl/homebrew/issues/9953#issuecomment-3800557
You can do:
sudo chown -R `whoami` /usr/local