Homebrew and ClamXav

Getting Hombrew and ClamXav to work together By Yihang Ho

Homebrew and ClamXav seem to have a little disagreement between them. This article is for those who:

  • are going to install ClamXav
  • have just installed ClamXav and Homebrew complains something about ownership and permissions
  • have installed ClamXav some time ago and it cannot update anymore worried

If you are just going to install ClamXav and have Homebrew installed already, please do a brew doctor and fix all problems first. If you are using TrueCrypt also, you might be interested to read this article also.

Immediately after you have installed ClamXav, do another brew doctor. Most probably you will get this message (and others if you have not fix them before installing ClamXav):

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.

If so, just enter the following command and you're (most likely) good to go.

sudo chown `whoami` /usr/local

If you have installed ClamXav and Homebrew some time ago, and ClamXav stops updating, you should continue reading. As we know, ClamXav updates its virus definition every time it is started, but this time, when it is started, very quickly it says that update completed, but when you run some scans, it complains that virus definition is outdated. In short, ClamXav refuses to update yet it complains that it is outdated. This problem is very likely due to permission issue on /usr/local/clamXav. This directory should be owned by root. Maybe you accidentally chowned that folder when you attempt to fix some other permission issues. To fix this,

sudo chown root /usr/local/clamXav