Get the free coreGet core

How macOS detects malware: from first open to background cleanup

Updated 5 min readSection 06 / Mac security
SHORT ANSWER

Mac malware detection in macOS is a chain of checks. Apple scans software that developers distribute outside the App Store before you get it, Gatekeeper checks it the first time you open it, XProtect scans apps at first launch and when they change, and XProtect keeps checking for infections afterwards. Your part: keep Software Update on automatic, in System Settings, General, Software Update. The steps are on the XProtect page. The chain has gaps, listed near the end.

01Mac malware detection at a glance

Apple builds its malware defenses in layers. The aim of the first is to stop malware before it launches even once, with the App Store, Gatekeeper and notarization together. The aim of the next is that, if malware appears on any Mac, it is quickly identified and blocked, to halt spread and to clean up Macs it has already reached. Apps from the App Store get an extra step: Apple reviews each one before it is accepted and signs it to make sure it was not tampered with. Here are the checks in the order you meet them, as one list of four steps, with a link to each part.

StepWhat happensWho does it
1. Before you get itApple scans software for known malware and issues a ticket if none is foundNotarization
2. First openBy default, all software is checked for known malicious content the first time it is openedGatekeeper
3. LaunchKnown malware is blocked and moved to the TrashXProtect
4. AfterwardsMalware that got through is removed, and checks repeat periodicallyXProtect

Steps 2 and 3 happen around the same moment: the first time you open an app. Gatekeeper checks it, and XProtect scans it. Each part has its own page, and below is one short paragraph per step.

02Step 1 and 2: Apple's scan and the first-open check

Notarization is the scan Apple runs before an app from outside the App Store reaches you, and macOS Catalina and later requires it by default. At first open, Gatekeeper checks for an identified developer, a notarization ticket and an unaltered app. It also tracks where files written by downloaded software came from. The details, the alerts and the Open Anyway button are on the Gatekeeper page.

03Step 3: launch

XProtect scans only apps that have been changed and apps at first launch. It automatically detects and blocks the execution of known malware. When that happens, the Mac says the app cannot be opened, moves it to the Trash and alerts you in the Finder. Signatures, sample sharing and updates are on the XProtect page.

04Step 4: the background cleanup

After launch, XProtect has a second job. It removes malware when it receives updated information, and it keeps checking for infections periodically. Apple's analysts track new malware, and that process, called threat intelligence, is how Apple identifies and blocks malware quickly. XProtect updates are issued automatically from the latest of it. By default, macOS checks for those updates daily. Part of XProtect also has an engine that looks for unknown malware by its behavior, not by a signature. Apple can also revoke the approval of an app that was notarized earlier.

If you think your Mac might have malware, update macOS and, if you are already on the latest version, restart. macOS includes a built-in tool that removes known malware when restarting. The XProtect clean-up engine does not restart the Mac by itself, so the restart is a step you take.

05What you will see along the way

Four messages can appear: a request for approval at first open, a warning that the app will damage your computer, a note that the app cannot be opened and was moved to the Trash, and an offer to share a copy of the malware with Apple anonymously. If you agree to share, XProtect uploads only the malware program itself, or the whole app if it sits in one. How to read each alert is in the table on the Gatekeeper page.

06Where Mac malware detection has gaps

XProtect signatures and notarization look for known malware, so a brand-new threat can go unseen for a while. Even with security software in place, malware might go undetected, at least temporarily.

Two more gaps come from how malware starts: signed and notarized malware, and a command you paste into Terminal. Both are explained once, on the Gatekeeper page. macOS 26.4 added a scan of commands pasted into Terminal before they run. Whether the gaps matter to you is the question on the do I need antivirus page.

07Checking by hand

A manual look is a separate job. Activity Monitor is an app that comes with the Mac. Open Spotlight, type its name and open it from there. It shows how much memory and CPU time each process uses. System Settings, General, Login Items & Extensions lists the apps, documents and server connections that open automatically when you log in. The step-by-step version is how to check your Mac for a virus. For symptoms, use signs your Mac has a virus and suspicious processes. If you find something, go to remove malware from a Mac.

None of this is a scan you start yourself: the checks above run on their own, and Apple's pages describe no button for a manual scan. In the Login Items list, a program you did not install and do not recognize is worth a look, and the suspicious processes page tells you what to do next.

08The short version

For Mac malware detection, macOS checks in order: Apple's scan before you get an app, Gatekeeper at first open, XProtect at launch, and XProtect again afterwards. Its signatures look for known malware, so keep Software Update on automatic. For how malware arrives, read can Macs get viruses, and to decide whether to add anything, see what to look for in a Mac virus scanner.

FAQ

How to tell if there's malware on your Mac?

Look at what runs and what starts by itself. Activity Monitor shows memory and CPU use per process, and System Settings, General, Login Items & Extensions lists what opens at login. The full order is on the virus check page.

Does Mac have built-in antivirus?

Yes. macOS includes built-in antivirus technology called XProtect for the signature-based detection and removal of malware. See XProtect.

Does Apple have a malware scanner?

Two. XProtect detects known malware by signature, and notarization is a malware scanning service that Apple provides for software before you get it.

When does macOS check an app for malware?

By default, all software is checked for known malicious content the first time it is opened. XProtect scans apps at first launch and apps that have changed.

Can macOS remove malware that already ran?

Yes, for known malware. XProtect acts to remove malware that has managed to run, and macOS includes a built-in tool that removes known malware when restarting.

What does the Mac do when it finds malware?

It blocks it, moves it to the Trash and alerts you in the Finder. See Gatekeeper for the alerts you may see at first open.

Sources

  1. Apple Platform Security, protecting against malware
  2. Apple Platform Security, Gatekeeper and runtime protection
  3. Apple Support, safely open apps on your Mac
  4. Apple Support, pop-ups and malware on Mac
  5. Apple Support, Activity Monitor processes
  6. Apple Support, Login Items & Extensions
  7. Apple Deployment guide, managing background tasks in macOS
  8. Microsoft Defender Experts, hunting infostealers on macOS
  9. Jamf Threat Labs, DigitStealer analysis
  10. Jamf Threat Labs, ClickFix on macOS
  11. Microsoft Defender Experts, ClickFix on macOS
  12. Objective-See, The Mac malware of 2025
  13. FTC, malware
  14. Artificial Immunity
macOS checks apps in order, from first open to background cleanup. Artificial Immunity's free, open-source core watches every program start and reports what it finds.Get the free core