brewedbits.dev

Personal blog with guides and news on selfhosting, Linux and AI, from the Netherlands

nextDash nextdash --aboutYour bookmarks. Your terminal. checks your links knows your Docker host one container, no cloudLive demo →nextdash.cc ↗

Tip: spctl --assess asks Gatekeeper about an app before you open it

Security
~/tips/tip-macos-spctl-assess

spctl --assess --verbose /Applications/SomeApp.app

Asks Gatekeeper whether an app or installer would be allowed, without opening it.

Gatekeeper is the part of macOS that decides whether an app from outside the App Store may run. Normally you only meet it as a warning dialog after a double-click. I like asking it first, from Terminal, especially for an app or installer I downloaded from a site I don’t know well.

The command:

spctl --assess --verbose /Applications/SomeApp.app

The answer is accepted or rejected, and the verbose output adds a source line that tells you why, for example that the app comes from a notarized Developer ID. Repeat the -v for more detail.

By default spctl assesses whether code may run. For an installer package you’d ask about installing instead, with -t install:

spctl --assess -t install --verbose ~/Downloads/installer.pkg

I’d use this before I’d ever reach for xattr to strip the quarantine flag off something. If Gatekeeper rejects it, that’s worth knowing before you open it.

Two caveats. spctl keeps a cache of earlier assessments; add --ignore-cache when you want a fresh answer, which can be a lot slower. And accepted means the signature and notarization check out, not that the app is nice to your files. The man page also lists --global-disable, which loosens Gatekeeper for the whole Mac. I’d leave that one alone.

Further reading: spctl man page, Gatekeeper and runtime protection in Apple Platform Security

More Security tips tcpdump -nn -r capture.pcap port 53 mkcert -install Strict-Transport-Security: max-age=0 Referrer-Policy: strict-origin-when-cross-origin wp super-admin list All Security tips (79) All topics

Link