LoginSignup
3
3

More than 5 years have passed since last update.

Mac用アンチウィルスソフトとHomebrewの所有権についてまとめ

Posted at

最近嵌ったのですが、どうやら検索に掛かる情報が少ないようなので備忘録含めて書き残します。

Sophos Anti-Virus編

10月のある日、brew installしようとしたらエラーを吐き、インストールができませんでした。
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: /usr/local/bin isn't writable.

This can happen if you "sudo make install" software that isn't managed by
by Homebrew. If a formula tries to write a file to this directory, the
install will fail during the link step.

You should probably `chown` /usr/local/bin

Warning: /usr/local/share isn't writable.

This can happen if you "sudo make install" software that isn't managed by
by Homebrew. If a formula tries to write a file to this directory, the
install will fail during the link step.

You should probably `chown` /usr/local/share

Warning: Some directories in /usr/local/share/man aren't writable.
This can happen if you "sudo make install" software that isn't managed
by Homebrew. If a brew tries to add locale information to one of these
directories, then the install will fail during the link step.
You should probably `chown` them:
    /usr/local/share/man
    /usr/local/share/man/man1

Warning: Your Homebrew is outdated.
You haven't updated for at least 24 hours. This is a long time in brewland!
To update Homebrew, run `brew update`.

つまりHomebrewに関わるディレクトリの所有権がおかしい([username]:adminroot:wheelに変更されている)ということです。
こちらを参考に自動でbrew updateするスクリプトを仕込んでいたのですが、それにも関わらずoutdatedの警告も出るのもおかしいです。
launchd で Homebrew を自動アップデート(Yosemite 編) - kymmt's note

一旦は直すんですが、一定時間後にまた同じようになっていました。
先述したスクリプトの所有者がroot:wheelになっていたのが関係しているのかと思ってスクリプトを削除しても、Homebrewを再インストールしても改善しません。
その後適当に検索したら、決定的な情報がありました。
Macで/usr/local/binの所有者が勝手に変わる問題について

Sophosのアップデートに、/usr/local以下の権限を勝手に変更してしまうというバグ(?)があるようでした。
対策として、Sophosをアンインストールし、代わりにAVGをインストールしました。さようなら。
というわけで自動スクリプトも仕込み直します。

ClamXAV編

使っていませんが、ClamXAVでも同様のトラブルはあったようです。
インストール時だけのようで、Sophosほど悪質ではないですが…。
ClamXAVインストールでhomebrewにトラブル発生 - 別館 子子子子子子(ねこのここねこ)

まとめ

今回2つのアンチウィルスソフトしか挙げていませんが、他にも/usr/localの所有権を変更するものがあるかもしれません。
ただchownするだけでは根本的な解決にならないので注意してください。

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3