Getting ClamXav to use a Proxy Server

I’ve been looking at different free Mac AV solutions so that I can make recommendations to less-computer-savy family members, and this afernoon I decided to give ClamXav a go. I’d tried it a few years ago and wasn’t very happy, but I’d been told by friends that it has improved a lot since, and a first glance at the GUI suggests they’re right. Unfortunately I didn’t get very far with my initial testing this afternoon because I’m in an environment where I have to use an HTTP proxy server to access the net, and ClamXav appears not to support proxies at first glance. It ignores OS X’s system-wide proxy settings, and it has no interface elements of its own to allow you to specify a proxy server manually. This implies that ClamXav doesn’t support proxies, but it actually does, they just didn’t bother to expose that functionality through the GUI.

ClamXav is just a GUI wrapper for the free and open source Clam AntiVirus toolkit, and it uses Clam’s regular auto-updating tool freshclam. Although the ClamXav GUI doesn’t give you control over the variables in the freshclam configuration file, that file does exist as part of ClamXav (/usr/local/clamXav/etc/freshclam.conf), and if you edit it manually it will respect the settings specified in that file. If you’re not afraid of the Terminal, you can easily edit this configuration file manually to get ClamXav to use a proxy server for updates.

These instructions will only work if you’re logged into an admin account, so if you normally run in a non-admin account, please log into your admin account before continuing. Start by opening a Terminal window (Applicationsâ†’Utilitiesâ†’Terminal), and then entering the command:

sudo nano /usr/local/clamXav/etc/freshclam.conf

This will open the freshclam configuration file in the nano text editor (if you’re comfortable on the Terminal you’ll probably prefer to use VI of course). Within this file, all lines starting with a # are considered comments, and ignored by freshclam when it loads it’s configuration. Lines starting with a # are said to be “commented out”. You need to scroll down through the file (using the cursor keys in nano) until you find the commented out proxy directives which will look something like this:

# Proxy settings
# Default: disabled
#HTTPProxyServer myproxyserver.com
#HTTPProxyPort 1234
#HTTPProxyUsername myusername
#HTTPProxyPassword mypass

You need to edit this section of the file to remove the # from the front of the HTTPProxyServer and HTTPProxyPort lines, and then you need to replace the place-holder values (myproxyserver.com and 1234) with the correct values for your proxy server. If your proxy server requires authentication you’ll also have to un-comment the two lines directly below these lines and enter your authentication details there.

You should be left with something that looks like this:

# Proxy settings
# Default: disabled
HTTPProxyServer proxy1.mydomain.ie
HTTPProxyPort 3128
#HTTPProxyUsername myusername
#HTTPProxyPassword mypass

Now you just need to save the file and exit the editor. In nano press ctrl+x and then hit y when asked if you want to save, and enter to confirm the file name to save to (it will default to the correct file name).

Restart ClamXav and you should now be able update your definitions without further issues.