spctl is the macOS command-line tool for the security assessment policy subsystem, better known as Gatekeeper. It lets administrators and developers check whether an application, installer package or disk image would be allowed to run or open, report whether assessments are enabled, and change parts of the policy from Terminal.
The name stands for system policy control. In the Terminal & scripting toolbox, spctl sits next to codesign, which signs and inspects code, and xattr, which manages the quarantine attribute that triggers Gatekeeper in the first place. Together these three tools explain most of what happens when a downloaded app is blocked.
How spctl evaluates software
spctl does not make decisions on its own; it is a client of the syspolicyd daemon, which holds the Gatekeeper policy and performs the actual assessment. When asked to assess an item, spctl sends the path to the daemon, which checks the code signature, the signing certificate chain and, for Developer ID software, the notarization ticket issued by Apple.
The result is either accepted or rejected, together with a source that explains why. Typical sources are Apple System for built-in software, Mac App Store for store apps, Notarized Developer ID for signed and notarized third-party apps, and no usable signature for unsigned code.
Gatekeeper normally runs only for files that carry the com.apple.quarantine extended attribute, which browsers and mail clients add to downloads. spctl, however, can assess any path on demand, which makes it a reliable way to predict Gatekeeper behavior before distribution.
Core spctl commands and options
Most daily use involves a small set of options. The table lists the commands administrators and developers reach for most often.
| Command | Purpose | Notes |
|---|---|---|
spctl --status | Shows whether assessments are enabled | Prints assessments enabled or disabled |
spctl --assess -vv App.app | Assesses an app for execution | Verbose output shows source and origin |
spctl -a -t install pkg | Assesses an installer package | The install type is required for packages |
spctl -a -t open --context context:primary-signature | Assesses a disk image or document | Used for signed DMG files |
spctl --global-disable | Requests that Gatekeeper be turned off | Recent releases require confirmation in System Settings |
spctl developer-mode enable-terminal | Shows Terminal under Developer Tools | Lets approved tools skip some checks |
The assessment type matters. The default type is execute, which suits applications; packages need the install type, and disk images or other documents need the open type. Using the wrong type produces misleading rejections that have nothing to do with the actual signature.
Reading spctl output
Verbose output is short but dense. The table below interprets the most common results and what they imply for the user experience.
| Result and source | Meaning | What the user sees |
|---|---|---|
| Accepted, Notarized Developer ID | Signed with Developer ID and notarized | A brief confirmation on first launch |
| Accepted, Mac App Store | Distributed through the App Store | Opens normally |
| Rejected, Unnotarized Developer ID | Signed but not notarized | A block that requires manual approval |
| Rejected, no usable signature | Unsigned or damaged code | A block or a report that the app is damaged |
| Accepted, Apple System | Software shipped by Apple | Opens normally |
The command also returns an exit status of zero for accepted items and a nonzero value for rejected ones, so scripts can branch on the result without parsing text. This is useful in build pipelines that must fail when a release is not notarized.
spctl compared with related security tools
Several macOS commands touch code security, and each answers a different question. The comparison clarifies where spctl fits.
| Tool | Question it answers | Typical command |
|---|---|---|
| spctl | Would Gatekeeper allow this item | spctl -a -vv App.app |
| codesign | Is the signature present and valid | codesign --verify --deep --strict App.app |
| xattr | Is the item quarantined | xattr -l App.app |
| stapler | Is a notarization ticket attached | xcrun stapler validate App.app |
| csrutil | Is System Integrity Protection enabled | csrutil status |
A valid signature alone is not enough. An app can pass codesign verification and still be rejected by spctl because it lacks notarization or uses a certificate type that Gatekeeper does not trust for distribution.
Changes across macOS releases
Apple has steadily narrowed what spctl can change while keeping its assessment role intact. Older releases allowed custom rules with labels and priorities through options such as --add and --list, and allowed Gatekeeper to be switched off silently with a master-disable option.
- Rule management has been deprecated, and custom rules are no longer a supported way to approve software; managed Macs use configuration profiles instead.
- Disabling Gatekeeper from Terminal now only exposes an extra choice in Privacy & Security settings, where the user must confirm the change with administrator credentials.
- Notarization became mandatory for Developer ID software, so spctl output shifted from simply signed toward notarized or not.
The practical lesson is to treat spctl as a diagnostic and verification tool first. Switching off Gatekeeper system-wide removes an important layer of protection against malware and should be avoided; approving a single trusted app in Privacy & Security is the safer choice.
In simple terms
A Mac has a security guard called Gatekeeper. It checks new apps before they run. It looks for a valid signature and a stamp from Apple.
spctl is a way to ask the guard questions by typing commands. A user can ask whether the guard is on. A user can also ask whether a certain app would be let in, and why.
Developers use it to check their apps before sharing them. That way, customers do not see a scary warning when they open the app for the first time.
A practical example
A small software team prepares a new release of its desktop app for customers who download it from the company website. Before publishing, a developer runs spctl -a -vv on the finished app bundle on a test Mac.
The output reads rejected with the source Unnotarized Developer ID. The signature is valid, but the notarization step failed silently in the build script. The developer resubmits the app to Apple’s notary service, staples the ticket with xcrun stapler staple, and runs spctl again, which now reports accepted with Notarized Developer ID.
The team then adds the same spctl check to its automated release pipeline, so the build stops whenever the exit status is nonzero. Customers receive an app that opens with only the standard first-launch confirmation, and support requests about blocked downloads drop sharply.