简体   繁体   中英

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.

在此输入图像描述

Thanks!!

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM