Fix access denied brew

 This fix the bug:

sudo chown -R "$(whoami)":admin /usr/local/lib

If you are fish shell, this works

sudo chown -R (whoami):admin /usr/local/lib

First answer in stackoverflow is valid.