Skip to content

Instantly share code, notes, and snippets.

@irfn
Forked from DerFichtl/clamav-macosx.md
Last active September 15, 2025 13:32
Show Gist options
  • Select an option

  • Save irfn/92005dd257cc902267ed147152c1719c to your computer and use it in GitHub Desktop.

Select an option

Save irfn/92005dd257cc902267ed147152c1719c to your computer and use it in GitHub Desktop.
clamav on mac osx - install and configure the virus scanner on mac osx
layout title published tags
post
clamav - install and configure on mac osx
true
blog
clamav

Install Clamav

Install clamav via homebrew

$ brew install clamav

Check the clamav config directory

$ ls /usr/local/etc/clamav

Create a minimum config (freshclam.conf) for the definition update command freshclam

$ echo "DNSDatabaseInfo current.cvd.clamav.net\nDatabaseMirror database.clamav.net" > /usr/local/etc/clamav/freshclam.conf

Configuration changes

clamconf -g freshclam.conf > freshclam.conf
clamconf -g clamd.conf > clamd.conf
clamconf -g clamav-milter.conf > clamav-milter.conf

mv clamd.conf /opt/homebrew/etc/clamav/clamd.conf
mv clamav-milter.conf /opt/homebrew/etc/clamav/clamav-milter.conf
mv freshclam.conf /opt/homebrew/etc/clamav/freshclam.conf

Edit files and remove the line following this comment

# Comment out or remove the line below.

Update freshclam virus definitions

$ freshclam

Scan your own users Downloads folder (takes some time to startup)

$ clamscan --infected --recursive ~/Downloads
----------- SCAN SUMMARY -----------
Known viruses: 6736785
Engine version: 0.102.2
Scanned directories: 32
Scanned files: 85
Infected files: 0
Data scanned: 2.41 MB
Data read: 1.65 MB (ratio 1.46:1)
Time: 18.931 sec (0 m 18 s)

Scan your files, create a logfile and move bad filtes to a quarantine folder

$ clamscan -r --log=~/clamav/log/scan.log --move=~/clamav/quarantine ~/Downloads

... or use the clamd demon for faster scanning.

clamd demon config and scanning

Add a minimal config for clamd

$ echo "LocalSocket /tmp/clamd.socket" > /usr/local/etc/clamav/clamd.conf

Start the clamd demon (takes some seconds)

$ clamd

Check if the clamd demon is running (end with 'q')

$ clamdtop

Use the clamdscan command instead of the clamscan command

$ clamdscan ~/Downloads
/Users/derfichtl/Downloads: OK

----------- SCAN SUMMARY -----------
Infected files: 0
Time: 1.298 sec (0 m 1 s)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment