会社などで Mac を貸与される事が多いのですが、前の所有者がディレクトリを作成していたりして所有権のエラーがでる場合があります。 どうやら前にこのPCを利用していた人が brew を使っていないケースで /usr/local のパーミッションがおかしいのかも。
% brew doctor Please note that these warnings are just used to help the Homebrew maintainers with debugging if you file an issue. If everything you use Homebrew for is working fine: please don't worry and just ignore them. Thanks! Warning: Unbrewed dylibs were found in /usr/local/lib. If you didn't put them there on purpose they could cause problems when building Homebrew formulae, and may need to be deleted. Unexpected dylibs: /usr/local/lib/libecomlodr.dylib
もともと brew が /usr/local を 0755 -> 0775 に変更して、グループを staff に置き換えるんですが どういうわけかそうなっていない状況なので以下のコマンドで修正をします。
sudo chgrp -R staff /usr/local sudo chmod -R 0775 /usr/local
たぶん /usr/local に brew 以外の方法で何かインストールするとそうなる気がする。