Skip to content

Instantly share code, notes, and snippets.

@afiqiqmal
Forked from mendozao/clamav-mac.md
Created September 28, 2020 16:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save afiqiqmal/1a907425b6ffb54d1aa69b6c4fac2333 to your computer and use it in GitHub Desktop.
Save afiqiqmal/1a907425b6ffb54d1aa69b6c4fac2333 to your computer and use it in GitHub Desktop.
Get ClamAV running on Mac OS X (using Homebrew)

Get ClamAV running on Mac OS X (using Homebrew)

The easiest way to get the ClamAV package is using Homebrew

$ brew install clamav

Before trying to start the clamd daemon, you'll need a copy of the ClamAV databases.

Inside /your/location/to/brew/etc/clamav, you'll see 2 files:

  1. freshclam.conf.sample
  2. clamd.conf.sample

Create copies of the samples:

$ cp freshclam.conf.sample freshclam.conf && cp clamd.conf.sample clamd.conf

Open up freshclam.conf, comment out "Example" from line 8, and make sure

DatabaseMirror database.clamav.net

is enabled. Save your changes.

Then run

$ freshclam -v

to download the ClamAV databases. The output will look something like this:

Current working dir is /usr/local/Cellar/clamav/0.98.1/share/clamav
Max retries == 3
ClamAV update process started at Tue Feb  4 11:31:22 2014
Using IPv6 aware code
Querying current.cvd.clamav.net
TTL: 1694
Software version from DNS: 0.98.1
Retrieving http://database.clamav.net/main.cvd
Trying to download http://database.clamav.net/main.cvd (IP: 81.91.100.173)
Downloading main.cvd [100%]
Loading signatures from main.cvd
Properly loaded 2424225 signatures from new main.cvd
main.cvd updated (version: 55, sigs: 2424225, f-level: 60, builder: neo)
Querying main.55.76.1.0.515B64AD.ping.clamav.net
...

Open up clamd.conf, and

  1. Comment: "Example" from line 8
  2. Uncomment: LocalSocket /tmp/clamd.socket from line 85
  3. Save your changes

Next, let's look for the location of clamd by running: $ brew ls clamav

You should see the following:

/your/location/to/brew/Cellar/clamav/0.99.2_1/bin/clamav-config
/your/location/to/brew/Cellar/clamav/0.99.2_1/bin/clambc
/your/location/to/brew/Cellar/clamav/0.99.2_1/bin/clamconf
/your/location/to/brew/Cellar/clamav/0.99.2_1/bin/clamdscan
/your/location/to/brew/Cellar/clamav/0.99.2_1/bin/clamdtop
/your/location/to/brew/Cellar/clamav/0.99.2_1/bin/clamscan
/your/location/to/brew/Cellar/clamav/0.99.2_1/bin/clamsubmit
/your/location/to/brew/Cellar/clamav/0.99.2_1/bin/freshclam
/your/location/to/brew/Cellar/clamav/0.99.2_1/bin/sigtool
/your/location/to/brew/Cellar/clamav/0.99.2_1/include/clamav.h
/your/location/to/brew/Cellar/clamav/0.99.2_1/lib/libclamav.7.dylib
/your/location/to/brew/Cellar/clamav/0.99.2_1/lib/libclamunrar.7.dylib
/your/location/to/brew/Cellar/clamav/0.99.2_1/lib/pkgconfig/libclamav.pc
/your/location/to/brew/Cellar/clamav/0.99.2_1/lib/ (4 other files)
/your/location/to/brew/Cellar/clamav/0.99.2_1/sbin/clamd  <------------- clamd location is here
/your/location/to/brew/Cellar/clamav/0.99.2_1/share/clamav/ (4 files)
/your/location/to/brew/Cellar/clamav/0.99.2_1/share/man/ (13 files)

To start the clamd daemon, run the following:

$ /your/location/to/brew/Cellar/clamav/0.99.2_1/sbin/clamd

You should now be able to scan a file by doing:

$ clamdscan /some/location/myfile.txt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment