Sub topic 14
What to do when Gatekeeper blocks an app
This chapter assumes you know what Gatekeeper, code signing, notarization and the quarantine attribute are, and that you can open Terminal and run a command. Here you will learn how to read a block message, decide whether to override it, and do so in the safest way.
Read the message first
Gatekeeper checks an app the first time you open it. The wording of the dialog tells you why it stopped the app.
| Message | Likely cause | First response |
|---|---|---|
| "Apple could not verify it is free of malware" | Signed with Developer ID, but not notarized, or the notarization check could not be completed | Check the source, then consider an override |
| "Apple checked it for malicious software and none was detected" (but the app is from an unidentified developer) | No Developer ID signature | Treat with extra suspicion |
| "Is damaged and can't be opened. You should move it to the Trash" | Signature broken, file modified, or an incomplete download | Delete it and download again from the official site |
| "Will damage your computer" | XProtect or Apple's malware list matched the app | Do not open it. Move it to the Trash |
The last row is not an override case. The remaining rows are decisions you make after checking where the app came from.
Decide whether to override
Before you override a block, answer these questions:
- Did you download the app from the developer's official site, reached by a link you typed or found yourself?
- Does the checksum match, if the developer publishes one?
- Does
codesignshow the Team ID you expect? - Do you need this app, and is there a Mac App Store version instead?
If you cannot answer yes to the first three, do not override. Delete the file.
codesign --verify --deep --strict --verbose=2 /Applications/Example.app
codesign -dv --verbose=4 /Applications/Example.app 2>&1 | grep -E 'Authority|TeamIdentifier'
spctl --assess --type execute --verbose=4 /Applications/Example.appA failed codesign --verify on a downloaded app means the contents changed after signing. Do not override that.
Override for a single app
macOS lets you approve one app at a time. This does not turn Gatekeeper off.
- Try to open the app once, then close the dialog.
- Open System Settings and choose Privacy & Security.
- Scroll to the Security section. A message names the blocked app.
- Click Open Anyway and confirm with your password or Touch ID.
- Click Open in the final dialog.
After this, macOS remembers your choice for that app. Other apps are still checked.
Removing quarantine by hand
You can clear the quarantine attribute from the command line. This skips the first-launch check for that file, so use it only for software you have already verified yourself, such as a tool you built from source.
xattr -l /Applications/Example.app
xattr -d com.apple.quarantine /Applications/Example.appThe first command lists the attributes. The second removes the quarantine flag from the app. If a site tells you to run this command on a download you have not verified, that is a warning sign.
Common mistakes
- Overriding because an installer's own instructions say to. Fake sites often include "right-click, Open" steps to get you past the warning.
- Ignoring "damaged" messages and trying to force the app open. A genuinely broken signature means the file is not what the developer shipped.
- Disabling Gatekeeper globally to fix one app.
Exercise
You download a utility from a site you found through a search ad. Gatekeeper says it could not verify that the app is free of malware. codesign -dv shows a Team ID that does not match the one on the developer's official page. What should you do?
Show answer
Do not override the block. The mismatched Team ID means the app was signed by someone other than the developer, so the download is probably not genuine. Move it to the Trash, then go to the developer's official site by typing the address yourself or using a link from a source you trust, and download the app again from there. Verify it with codesign and spctl before opening it.