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?


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:

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

Returns assessments enabled or assessments disabled accordingly.

System info: AppleScript version: 2.7 System version: 10.13.6

|improve this answer|||||
  • Running the do shell at it's current state throws an AppleScript Execution Error. – ʀ2ᴅ2 Oct 19 '18 at 16:15
  • made an edit to the question with an image. – ʀ2ᴅ2 Oct 19 '18 at 16:18
  • Awe I see, I forgot you could throw it like that in a try block. – ʀ2ᴅ2 Oct 19 '18 at 16:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .