Making Malwarebytes Anti-Malware Scan Automatically on Your Mac
Author’s Note: I’ve edited this article. It appears WordPress changed some quotation marks into “curly” quotation marks in the code. Sorry if you tried it and it failed; it should work now!
I set out to create a way to make Malwarebytes Anti-Malware scan automatically. It’s vital to run a malware detection and removal app on your Mac, and while Malwarebytes Anti-Malware is one of my favorites, it doesn’t scan automatically. This became blatantly obvious recently when Handbrake was infected with malware. The problem is, most people don’t need to run such a scan daily, and we forget if it’s not part of our day-to-day routine. With that in mind, let me show you how I made Malwarebytes Anti-Malware scan automatically.

Don’t let this guy get the best of you when you can make Malwarebytes Anti-Malware scan automatically (Image Credit: HypnoArt)
What Apps Do I Need?
To make Malwarebytes Anti-Malware scan automatically, we need a couple of apps. First, of course, is Malwarebytes Anti-Malware itself—it’s free. Second, you should download and install Keyboard Maestro. It’s a paid app, but you can try it for free and make sure it does what you need it to. Honestly, once you start using Keyboard Maestro, you might be glad I introduced you to it—and Dr. Mac can’t say enough good things about it. In addition to everything else it does, Keyboard Maestro has a clipboard manager that’s second to none.
Making Malwarebytes Anti-Malware Scan Automatically
The first thing we need is a way to automatically launch Malwarebytes Anti-Malware for macOS Sierra and tell it to scan our Mac. I accomplished this with an AppleScript that I compiled into its own application. You can do that by launching Applications -> Utilities -> Script Editor and creating a new document. Once your new document appears, enter the following code by copying and pasting it.
do_menu("Malwarebytes Anti-Malware", "Scanner", "Scan")
on do_menu(app_name, menu_name, menu_item)
try
-- This should launch and bring Malwarebytes Anti-Malware to the front
tell application app_name
activate
end tell
delay 5
-- Now we’ll kick off a scan
tell application "System Events"
tell process app_name
tell menu bar 1
tell menu bar item menu_name
tell menu menu_name
click menu item menu_item
end tell
end tell
end tell
end tell
end tell
return true
on error error_message
return false
end try
end do_menu
Compile the script, and save it to /Applications as an application named malwarebytes-automate. Run the app once, both to set up some security permissions needed and to make sure it works. The app will ask you to grant it Accessibility permission in System Preferences -> Security & Privacy -> Privacy, so make sure you do that. Run the automation app one more time, and make sure it kicks off the scan.
Now, the Magic of Keyboard Maestro Automation
Next, we’ll set up Keyboard Maestro to automatically run our malware scan once a month. Launch Keyboard Maestro, if you haven’t already, and click File -> New Macro. Give your new macro a name, then click the green and white plus sign labeled New Trigger. Choose Periodic Trigger. Next, configure the trigger to repeat every one hour between a particular almost-two-hour period of time. I chose 2 a.m. to 2:59 a.m., because I’m not likely to be using my Mac during that time.
With the time set, select the day (or days) when you want the scan to run. Remember, midnight is technically the following day, so plan accordingly.
Related
Now that you’ve scheduled your macro, it’s time to tell it what to do. Next, click the green and white arrow labeled New Action, then choose All Actions -> Activate a Specific Action. Choose your automation script, which you should have named malwarebytes-automation. Make sure All windows is checked and “leave it at the front” is selected for If already at the front. Once done, your macro should look something like mine.
Finally, test it out by clicking the Try button at the bottom of the window, and make sure it works. Once done, you can quit the Keyboard Maestro Editor, and rest assured that Malwarebytes Anti-Malware will scan your system automatically, keeping you safe from Trojans and other nefarious software intrusions.
0 Response to "Making Malwarebytes Anti-Malware Scan Automatically on Your Mac"
Post a Comment