Skip to content

Instantly share code, notes, and snippets.

@subharanjanm
Forked from dkobia/clamav-mac.md
Created August 30, 2016 14:16
Show Gist options
  • Star 17 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save subharanjanm/be799ee57854109c3860dde9ad823754 to your computer and use it in GitHub Desktop.
Save subharanjanm/be799ee57854109c3860dde9ad823754 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 process, you'll need a copy of the ClamAV databases.

Create a freshclam.conf file and configure as so

# /usr/local/etc/clamav/freshclam.conf
DatabaseMirror database.clamav.net

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
...

Next we'll need to create a clamd.conf

# /usr/local/etc/clamav/clamd.conf
LocalSocket /usr/local/var/run/clamav/clamd.sock

You'll need to ensure that the socket directory exists

$ mkdir /usr/local/var/run/clamav

You should now be able to run

$ clamd

to start the process.

@subharanjanm
Copy link
Author

ERROR: Please edit the example config file /usr/local/etc/clamav/freshclam.conf
ERROR: Can't open/parse the config file /usr/local/etc/clamav/freshclam.conf

Then check the freshclam.conf in a text editor and it seems to be telling us how to fix it: "Comment or remove the line below." That must be referring to the line that just says "Example" so let's delete that line and save the file.

Refer: Homebrew/homebrew-core#1900

Copy link

ghost commented Jan 23, 2018

I made it to the step "Next we'll need to create a clamd.conf"....

mac-4:~ root# /usr/local/etc/clamav/clamd.conf
-sh: /usr/local/etc/clamav/clamd.conf: Permission denied

Why am mI getting the permission denied error in the root?

@rshokati
Copy link

You need to change the ownership of the clamav directory to the clamav user via chown.

@Foadsf
Copy link

Foadsf commented May 21, 2018

I followed all the steps but I got the error:

-bash: clamd: command not found

@georgelund
Copy link

The clamd command is installed by brew into /usr/local/sbin. If you're getting command not found, you either need to run it from /usr/local/sbin or add /usr/local/sbin to your path.

@valentin-hc
Copy link

-bash: clamd: command not found
Had to fight my way through similar issues and since I made a small recap for my company I though I might as well share it in a gist.
Hope that helps someone in the future.

https://gist.github.com/valentin-hc/085d987031d713de0340994373575045

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment