How to get to Microphone ‘tab’ under “Privacy" under "Security & Privacy” in System Preferences

I want to be able to easily toggle Microphone and Camera access for but I’m not sure how to best navigate the System Preferences window.

Here’s a screenshot showing the order of clicks that would need to happen:

I can do steps 1, 2, and 3 with this bit of AppleScript which I cobbled together from googling:

tell application "System Preferences"
	set securityPane to pane id ""
	-- tell securityPane to reveal anchor "Privacy_Camera"
	tell securityPane to reveal anchor "Privacy_Microphone"
end tell

There does not seem to be a way to get to step 4. At least none that I could find. Perhaps Apple doesn’t want to make this something that can be automated so it can’t be abused? I dunno.

Anyone know how to get to step 4 and toggle “” on or off?

Unrelated: It bothers me to no end that the left column that starts with Location Services is not alphabetized, and I can’t re-order them.

I could make it work by adding an Accessibility script to your existing script:

# Set the name of the item (app) you want to enable/disable
set theApp to "<the name of the app as it appears in the table>"
# Set this to true if you want to enable the item, or to false to disable it
set enableItem to true

tell application "System Preferences"
  set securityPane to pane id ""
  tell securityPane to reveal anchor "Privacy_Microphone"
end tell

# Delay to give the system time to call the preferences pane
# Set it to the lowest value that reliably works with *your* setup
delay 0.8

tell application "System Events"
  tell application process "System Preferences"
    tell window 1
      tell tab group 1
        tell group 1
          tell scroll area 1
            tell table 1
              repeat with r in rows
                if name of UI element of r contains theApp then
                  tell checkbox 1 of UI element of r
                    set isEnabled to value as boolean
                    if enableItem ≠ isEnabled then click
                    set theResult to value as boolean
                  end tell
                  exit repeat
                end if
              end repeat
            end tell
          end tell
        end tell
      end tell
    end tell
  end tell
end tell



  • The theResult variable only serves to report back the status of the checkbox after the Click action.
  • Settings are explained in the script.



  • Changed the action from toggling to a pre-settable action (enable or disable)
  • Added some explanations in the script


  • Made the enable (click) condition a bit more compact

Wow! That is a lot of tell commands! Thanks! I would not have figured that out.

Is there a way to create one of these specifically to make sure the box is checked
and another to make sure that the box is not checked ?

Thanks again

I added a setting (see beginning of the script) that lets you select if you want to enable or disable the item.

Excellent! Thank you. I appreciate your time.

Just made a small (formal) change to the script.