0

I am battling to install ClamAV on my Macbook with macOS Monterey. I am new to open-sourced software and using mac's Terminal commands to solve problems. I have followed online advice and advice from a colleague up to a point, and it just is not working.

==> Pouring clamav--0.105.1.arm64_monterey.bottle.tar.gz

==> Caveats To finish installation & run clamav you will need to edit the example conf files at /opt/homebrew/etc/clamav/

==> Summary /opt/homebrew/Cellar/clamav/0.105.1: 177 files, 25.4M

==> Running brew cleanup clamav... Disable this behaviour by setting HOMEBREW_NO_INSTALL_CLEANUP. Hide these hints with HOMEBREW_NO_ENV_HINTS (see man brew).

==> Caveats

==> clamav To finish installation & run clamav you will need to edit the example conf files at /opt/homebrew/etc/clamav/

  • I can't recall where I went for help with what to do next, but I recorded that I ran the following [bobmcbob being stand in for my actual user name]:

bobs-MacBook-Air-2:~ bobmcbob$ cp /usr/local/etc/clamav/freshclam.conf.sample /usr/local/etc/clamav/freshclam.conf

cp: /usr/local/etc/clamav/freshclam.conf.sample: No such file or directory

bobs-MacBook-Air-2:~ bobmcbob$ sed -i '' 's/Example/# Example/' /usr/local/etc/clamav/freshclam.conf

sed: /usr/local/etc/clamav/freshclam.conf: No such file or directory

bobs-MacBook-Air-2:~ bobmcbob$ cp /usr/local/etc/clamav/freshclam.conf.sample /usr/local/etc/clamav/freshclam.conf

cp: /usr/local/etc/clamav/freshclam.conf.sample: No such file or directory

bobs-MacBook-Air-2:~ bobmcbob$ cp /usr/local/etc/clamav/freshclam.conf.sample /usr/local/etc/clamav/freshclam.conf

cp: /usr/local/etc/clamav/freshclam.conf.sample: No such file or directory

bobs-MacBook-Air-2:~ bobmcbob$ cp /usr/local/etc/clamav/freshclam.conf.sample /usr/local/etc/clamav/freshclam.conf

cp: /usr/local/etc/clamav/freshclam.conf.sample: No such file or directory

bobs-MacBook-Air-2:~ bobmcbob$ cd /usr/local/etc/clamav

-bash: cd: /usr/local/etc/clamav: No such file or directory

bobs-MacBook-Air-2:~ bobmcbob$

  • I then contacted a colleague and told them: "I have been stumped at this instruction: To finish installation & run clamav you will need to edit the example conf files at /opt/homebrew/etc/clamav/". You will see that instruction above.
  • My colleague advised me to run the following:

sudo mkdir /usr/local/sbin

sudo chown -R whoami :admin /usr/local/sbin

brew link clamav

cd /usr/local/etc/clamav

cp freshclam.conf.sample freshclam.conf

sed -ie s/^Example/#Example/g fresh.conf

  • This, they said, would "install clamav, switch to the installation directory make a copy of the configuration file; then modify the configuration file to allow clamav function"
  • However I got stumped at the second one sudo chown -R whoami :admin /usr/local/sbin ...The outcome was this:

chown: :admin: No such file or directory

  • I then tried this, having removed the space from whoami:admin: to whoami :admin This is what happened:

bobmcbob@bobs-MacBook-Air-2 ~ % sudo chown -R whoami:admin /usr/local/sbin

Password:

bobmcbob@bobs-MacBook-Air-2 ~ %

bobmcbob@bobs-MacBook-Air-2 ~ % brew link clamav

Warning: Already linked: /opt/homebrew/Cellar/clamav/0.105.1

To relink, run:

brew unlink clamav && brew link clamav

bobmcbob@bobs-MacBook-Air-2 ~ % brew unlink clamav && brew link clamav

Unlinking /opt/homebrew/Cellar/clamav/0.105.1... 46 symlinks removed.

Linking /opt/homebrew/Cellar/clamav/0.105.1... 46 symlinks created.

bobmcbob@bobs-MacBook-Air-2 ~ % cd /usr/local/etc/clamav

cd: no such file or directory: /usr/local/etc/clamav

bobmcbob@bobs-MacBook-Air-2 ~ %

I just don't know what to do next, and would be grateful for some help.

1 Answers1

0

I have only managed to get clamscan and not clamdscan running so I'll share with you what I have done to get that running.

I have installed homebrew in its default location for Catalina so my configuration files are in /usr/local/etc, but the instructions should be the same.

Since you have already created the freshclam.conf and clamd.conf files, you need to make some edits to the files. The easiest to do this is to use the build in terminal text editor nano. On your terminal type the following:

sudo nano /opt/homebrew/etc/clamav/freshclam.conf

Once inside the nano text editor, put a hash symbol (#) in front of the line that says "Example" then press ctrl + O to save and ctrl + X to.

Next, edit the clamd.conf file.

sudo nano /opt/homebrew/etc/clamav/clamd.conf

Comment out the line that says "Example".

Uncomment and make the following edits as per the follow post Warnings/Errors when running clamav/clamscan, scanning 3TB hard-drive, then save and exit clamd.conf:

Maxfilesize 4000M
MaxScanSize 4000M
BytecodeTimeout 190000

To find things faster in nano follow this guide.

Run freshclam in the terminal to download the latest updates:

freshclam

At this point you should be able to run clamscan. The following example scans your everything in your home folder and lists any infected files.

clamscan -r -i --remove ~/Desktop

If you want to check the files before removing omit --remove

Note: You may get a verification failed error message like the one mentioned in this post.

Also, when scanning larger directories like the home folder there are more issues. I still get the following message: LibClamAV Warning: Bytecode 78 failed to run: Exceeded time limit, despite changing the BytecodeTimeout value in clamd.conf.

There will also be periodic prompts about Terminal needing access to your contacts, calendar, etc. However, in both cases the scan should still run.

Train
  • 1