After installing software, I need to allow it to load in Security & Privacy. How do I do it with a script?

So I'm working on deploying a piece of software for our organization. I deployed it with JAMF and it seems to work just like expected (exactly like if I installed it manually).

The thing is, that after installation finishes, I have to got to Settings -> Security & Privacy and in General tab I can see the message:

System software from developer "XXX" was blocked from loading.

If I click the Allow button to the right, it is finished - program runs as expected.

The question is - how do I do it automatically, ex. with a script? Including the pop-up message just after installation that informs user, that it has to be allowed from settings?


That's the whole point of Gatekeeper. The user needs to manually allow for an application to run or have access to control your computer. Otherwise any malicious application could just grant itself access and permissions to run and control your computer.

Your best option would be creating a Readme.txt file with explicit step-by-step instructions on how to grant access and permissions for that application, to control your computer, in System Preferences.app

This following AppleScript code, In MacOS Mojave, will bring you to the System Preferences window where you can address the "If I click the Allow button to the right" issue that you have mentioned.

tell application "System Preferences"
    activate
    tell its pane id "com.apple.preference.security"
        reveal anchor "General"
    end tell
end tell

And this AppleScript code will bring you to where you need to set Accessibility, Full Disk Access, and Automation privileges for the application.

tell application "System Preferences"
    activate
    tell its pane id "com.apple.preference.security"
        reveal anchor "Privacy_Accessibility"
    end tell
end tell