I have a standard homebrew install inside of usr/local/
When I try:
Larson-2:~ larson$ brew install postgresql Error: Cannot write to /usr/local/Cell
The problem can be solved by changing the directory's owner to the current user:
sudo chown -R $USER /usr/local
This answer is taken from: https://github.com/Homebrew/homebrew/issues/17884