I'm familiar with running the AppleScript command:

do shell script "sudo spctl --master-disable" with administrator privileges

to allow the ability in Security to select Anywhere but is there a way in AppleScript to detect if spctl is enabled or disabled?


Edit:

Running the do shell with:

do shell script "spctl --status"

will throw a Script Editor in Script Editor:

enter image description here

Is there a way to get the status without it throwing an error?

有帮助吗?

解决方案

I think what you're looking for could be:

try
    do shell script "spctl --status"
on error E
    E
end try

Returns assessments enabled or assessments disabled accordingly.


System info: AppleScript version: 2.7 System version: 10.13.6

许可以下: CC-BY-SA归因
不隶属于 apple.stackexchange
scroll top