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