ClamXAVインストールでhomebrewにトラブル発生

 $ brew doctor
Warning: The /usr/local directory is not writable.
Even if this directory was writable when you installed Homebrew, other
software may change permissions on this directory. Some versions of the
"InstantOn" component of Airfoil are known to do this.

You should probably change the ownership and permissions of /usr/local
back to your user account.

同様のトラブルが発生した記録でいちばん分かりやすいのはこちら
[Homebrew] ClamXav導入後"brew update"がエラーになる: 黄昏てなんかいられない
簡単に言えば
Yihang
に従って

$ sudo chown `whoami` /usr/local

とすればOK。それでだめならば

$sudo chmod 775 /usr/local

パーミッションを775にしてください。
(メッセージにちゃんと「/usr/localの所有権とパーミッションをあなたのアカウントにしてね」と書いてあるんですけどね…英語が読めないわorz)

もしsudo chown -R $(whoami) /usr/local した場合にClamXAVが動かなくなったら

If things fail with permissions errors you should check the permissions in /usr/local. If you’re unsure what to do, you can:

sudo chown -R $(whoami) /usr/local

GitHub - Homebrew/legacy-homebrew: The former home of Homebrew/homebrew (deprecated)

に従ってchown -Rした場合には、/usr/local以下のパーミッション再帰的にあなたのアカウントへ変更されます。実は

This problem is very likely due to permission issue on /usr/local/clamXav. This directory should be owned by root.
Yihang

すなわち、/usr/local/clamXav の所有権がrootじゃないとまずいわけです。
ということで

$ sudo chown root /usr/local/clamXav

してください。