YU FENG
YU FENG

Reputation: 888

Objective c: How to change option in "Security & Privacy" via terminal

I want to change the selection of "Allow applications downloaded from :" to anywhere via terminal.

enter image description here

Thanks!!

Upvotes: 0

Views: 2651

Answers (1)

Anya Shenanigans
Anya Shenanigans

Reputation: 94614

These 3 settings are a combination of a big on/off switch and the system policy database. These settings affect the syspolicyd, and how it interacts with the system.

The 'master on/off' switch can be configured using the spctl command line tool. Managing these settings requires administrator privileges. To turn it off you use:

sudo spctl --master-disable

To enable it you use:

sudo spctl --master-enable

To check if it's in on/off you use

spctl --check-status

The App Store vs. Identified Developers option is controlled by the content of the database. Rules get enabled/disabled based on this setting. I don't know the exact format of the database (I spent a short time reverse engineering it, but didn't care enough to follow it through), and I'm sure that Apple could change it between releases, so knowledge gained about the format would need to be relearned between releases.

It's probably not the answer you're looking for, but it seems to be how it's implemented in the system.

Upvotes: 2

Related Questions