Skip to content

Instantly share code, notes, and snippets.

@Uchean
Created December 9, 2015 23:36
Show Gist options
  • Star 92 You must be signed in to star a gist
  • Fork 23 You must be signed in to fork a gist
  • Save Uchean/4fdc875e557014c3a34e to your computer and use it in GitHub Desktop.
Save Uchean/4fdc875e557014c3a34e 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/clamd.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/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.

@NikhilNanjappa-zz
Copy link

Add this in your bash_profile if you are getting a can't find command clamd

export PATH=/usr/local/sbin:$PATH

Also, the main post's location for clamd.conf is wrong. Put it inside the clamv directory one directory in.

This resolved my "clamd command not found" issue.

@vasanthsg
Copy link

Would appreciate updating the install procedure. Without reading the comments below, it couldn't have worked. @kamok Thank you for pointing the path export.

@MarkVLK
Copy link

MarkVLK commented Jun 24, 2020

Add this in your bash_profile if you are getting a can't find command clamd
export PATH=/usr/local/sbin:$PATH
Also, the main post's location for clamd.conf is wrong. Put it inside the clamv directory one directory in.

This resolved my "clamd command not found" issue.

By the way, if you're on macOS Catalina or higher and moved from bash to zsh, you'll need to use .zprofile instead of .bash_profile. See this StackOverflow question + answer for more details: https://stackoverflow.com/questions/56784894/macos-catalina-10-15beta-why-is-bash-profile-not-sourced-by-my-shell

@cmyk
Copy link

cmyk commented Jan 30, 2024

Terribly outdated instructions. My homebrew is installed in /opt/local

@cmyk
Copy link

cmyk commented Jan 31, 2024

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