How can you disable Gatekeeper via Terminal Commands in OS X 10.8 Mountain Lion? I am looking to replicate the Security & Privacy preference pane selection to allow applications downloaded from Anywhere to run:
By having a terminal command, I can write a script to do this task remotely rather than manually going to each Mac and changing these settings with a mouse and several clicks.
Best Answer
The spctl tool should do the job.
sudo spctl --master-disable
will turn off the Gatekeeper checks, andsudo spctl --master-enable
will re-enable them (to the default setting of App Store and signed apps — it doesn't appear that setting it to App Store-only is possible).Note that it will not throw any error if you run it without
sudo
permissions, butsudo
is in fact required.