Herr Bischoff

How to Install and Run ClamAV on macOS

This is a mini-HOWTO, a kind of cheatsheet to link to for myself and others looking for high information density as opposed to SEO-optimized garbage. You know the type of posts I mean.

The following instructions enable the most basic install with default options throughout. More options can be set in the conf files.

Install ClamAV with Homebrew:

brew install clamav

Configure freshclam:

cp /usr/local/etc/clamav/freshclam.conf.sample /usr/local/etc/clamav/freshclam.conf
sed -i '' 's/Example/# Example/' /usr/local/etc/clamav/freshclam.conf

Run freshclam several times, until there are no more updates.


Configure clamd:

cp /usr/local/etc/clamav/clamd.conf.sample /usr/local/etc/clamav/clamd.conf
sed -i '' 's/Example/# Example/' /usr/local/etc/clamav/clamd.conf

Run clamscan:

clamscan path/to/file/or/folder

Create a cronjob to automatically download new virus signatures:

crontab -e
@hourly             /usr/local/bin/freshclam > /dev/null 2>&1