ClamAV on MacOS via pkgsrc

I desired to be able to do an anti-virus scan on my MacBook.  After trying and paying for several large proprietary alternatives and being dissatisfied I decided to try and use ClamAV like I do on Gnu/Linux.

At the time of this writing there is a proprietary GUI using ClamAV in the backend but that didn’t seem interesting.

I then tried to build ClamAV from source but stopped after a few hours of errors. Nevertheless it was a nice learning experience dealing with GCC and LLVM.

Finally the best solution in my case was to use pkgsrc.  It’s a package manager familiar to us GNU/Linux users.  From their website:

pkgsrc is a framework for building over 17,000 open source software packages. It is the native package manager on SmartOS, NetBSD, and Minix, and is portable across 23 different operating systems. Use one package manager across all of your systems!

Joyent provide binary packages for SmartOS/illumos, Mac OS X, and Linux.

The documentation on Joyent’s website was clear and easy to follow.  Once pkgsrc was installed, I could move on to the ClamAV documentation which was also very good.

Now when I want to do a quick scan of a suspect directory it’s just update and run.

sudo /opt/pkg/bin/freshclam

clamscan -r -l scan.txt /Path/to/your/directory

After using this solution for several months I have no complaints.  Another benefit is access to all of the binaries from Joyent.

Worth checking out if you’re in need of getting ClamAV running on MacOS.