Skip to content

Instantly share code, notes, and snippets.

@eraad
Forked from DerFichtl/clamav-macosx.md
Created June 4, 2022 09:50
Show Gist options
  • Select an option

  • Save eraad/2376f6e6d4d86a951a74137be344bde3 to your computer and use it in GitHub Desktop.

Select an option

Save eraad/2376f6e6d4d86a951a74137be344bde3 to your computer and use it in GitHub Desktop.
clamav on mac osx - install and configure the virus scanner on mac osx
layout post
title clamav - install and configure on mac osx
published true
tags
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

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