I found this link…
which allows the user to Disable and Enable gatekeeper via Terminal.
How could I code that in my app so that I do not have to open Terminal?
I have this…
Dim GatekeeperCommand as String = "sudo spctl --master-disable"
Dim GatekeeperShell as new Shell
I am aware that the password somehow has to be added.
AFAIK you cannot sudo from shell, and Terminal is not scriptable.
You know, the best way to have Gatekeeper leave you alone is to sign your application.
When Gatekeeper got locked down, Apple also locked sudo down by setting the requiretty sudo flag so that you can’t using the old sudo -S option to pass the password through as an argument like this:
echo thePassword | sudo -S /usr/bin/true (works through 10.9 and some 10.10)
You could get the user to modify their /private/etc/sudoers file, but that requires the same level of access as asking them to run that sptcl command.
As Michel states, the best answer is to codesign your apps