使用homebrew安装mysql遇到一个错误提示:

Error: Permission denied - /usr/local/var

根据github上的回答:

You may have sudo installed something which altered permissions on /usr/local. Try: sudo chown -R $USER:admin /usr/local

也就是可能之前我sudo安装了一些东西,导致/usr/local被刷新为root的了。

需要设置回来:

sudo chown -R "$USER":admin /usr/local
sudo chown -R "$USER":admin /Library/Caches/Homebrew

参考资料