Skip to content

MacOS spctl command

The MacOS spctl command allows users to control and manage the security assessment policies on their system efficiently. With spctl, users can add, remove, and evaluate security assessment rules, as well as manage the assessment subsystems. This command plays a crucial role in maintaining the security and integrity of MacOS systems by providing a way to verify and manage the applications and processes running on the system. Additionally, spctl can be used to manage kernel extensions, package manifests, and individual files. By understanding and utilizing the spctl command effectively, MacOS users can ensure that their system remains secure and protected from potentially harmful applications and processes.

spctl Syntax:

Terminal window
spctl [option] [parameter]

Options:

OptionDescription
-a, —assessAssess the specified file or directory
-t, —testTest without a policy check
—addAdd a new policy
—enableEnable a disabled policy
—disableDisable an enabled policy
—removeRemove a policy
—resetReset all policies to the system’s defaults
—statusDisplay the general status

Parameters:

ParameterDescription
file/directoryThe file or directory to be assessed/tested

spctl Usage:

Check if an Application is Allowed to Run

Terminal window
spctl -a /Applications/MyApp.app

This command checks if the application “MyApp” located in the /Applications folder is allowed to run.

Add an Application to the Allowed List

Terminal window
spctl --add /Applications/MyApp.app

This command adds the application “MyApp” located in the /Applications folder to the allowed list, allowing it to run without being blocked.

Remove an Application from the Allowed List

Terminal window
spctl --remove /Applications/MyApp.app

This command removes the application “MyApp” located in the /Applications folder from the allowed list, preventing it from running without additional authorization.

List Information About a Specific Application

Terminal window
spctl -t exec -vv /Applications/MyApp.app

This command provides detailed information about the application “MyApp” located in the /Applications folder, including its status and other relevant details.

How do I check the status of the spctl in MacOS?

To check the status of the spctl in MacOS, run the following command:

Terminal window
spctl --status

How do I add a new rule to the spctl in MacOS?

To add a new rule to the spctl in MacOS, use the following command:

Terminal window
spctl --add /path/to/application

How do I remove a rule from spctl in MacOS?

To remove a rule from spctl in MacOS, you can execute the following command:

Terminal window
spctl --remove /path/to/application

How do I clear all rules from spctl in MacOS?

To clear all rules from spctl in MacOS, issue the following command:

Terminal window
spctl --reset

How do I enable the spctl assessment in MacOS?

To enable the spctl assessment in MacOS, use the command below:

Terminal window
spctl --master-enable

How do I disable the spctl assessment in MacOS?

To disable the spctl assessment in MacOS, execute the following command:

Terminal window
spctl --master-disable

Applications of the spctl command

  • Checking the status of Gatekeeper
  • Enabling or disabling Gatekeeper
  • Managing the security assessment policy
  • Verifying software before installation
  • Managing software restrictions
  • Customizing security settings for specific software sources