So, I decided to go back to using Free Download Manager on Mac. It always had this setting to do an antivirus scan. Antivirus software is more like adware bloat these days, which does more harm than good, in my opinion. But it would be neat to be able to scan files, right? So I thought, I could just install ClamAV through MacPorts, and run clamscan, right?
Well, in theory this works, but since this is a terminal program, it won’t show anything, which defeats the point of doing a scan.
So, I figured, sure enough, I must be able to run the built-in macOS Terminal in some way, right?
Sure enough, you can:
/System/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal
And you can even pass a command to it!
But here’s where problems begin:
/System/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal /opt/local/bin/clamscan /path/to/scan
This will start two Terminal windows, one for clamscan, which will, naturally, just scan the home folder, and another Terminal window, with the path to scan.
Somehow, I can’t pass more than one command to the Terminal!
So, I thought about it, and figured it out:
I created a little helper program /usr/local/bin/clamgui
:
#!/bin/sh
export SCANPATH="$1"
/System/Applications/Utilities/Terminal.app/Contents/MacOS/Terminal /usr/local/bin/clamstarter
All it does, is take the path as passed from FDM, and feed it into an environment variable, which is exported.
Then it starts the macOS Terminal app, with yet another helper program /usr/local/bin/clamstarter
:
#!/bin/sh
/opt/local/bin/clamscan "$SCANPATH"
Which, in turn, runs clamscan, and reads the environment variable we created earlier, and passes it to clamscan as path!
Now, when I want to check a download, I can just right-click and choose “Perform virus check”, which will open a Terminal window and run clamscan.
Virus scan, without bloat!
And the best part is, this clamgui helper program should work for anything where you can run a command from a GUI!
I run this blog in my free time, if this helped you out, consider donating a coffee. (:
Leave A Comment