Skip to content

Instantly share code, notes, and snippets.

@rmcdongit
Last active September 13, 2024 06:49
Show Gist options
  • Save rmcdongit/f66ff91e0dad78d4d6346a75ded4b751 to your computer and use it in GitHub Desktop.
Save rmcdongit/f66ff91e0dad78d4d6346a75ded4b751 to your computer and use it in GitHub Desktop.
Apple System Preferences URL Schemes

macOS 10.15 System Preference Panes

Below are a list of System Preference pane URLs and paths that can be accessed with scripting to assist users with enabling macOS security settings without having to walk them through launching System Preferences, finding panes, and scrolling to settings. Not all panes have an accessible anchor and some are OS specific.

To find the Pane ID of a specific pane, open the System Preferences app and select the desired Preference Pane. With the pane selected, open the ScriptEditor.app and run the following script to copy the current Pane ID to your clipboard and display any available anchors:

tell application "System Preferences"
	set CurrentPane to the id of the current pane
	set the clipboard to CurrentPane
	get the name of every anchor of current pane
end tell

Opening with URL Schemes

If the preference pane supports it, you can open them with a URL in terminal using the following syntax (replace <PaneID> with the desired pane ID):

open "x-apple.systempreferences:<PaneID>"

Open with System Preferences Bundle Identifier and Pane Path

You can also access the main preference panes using the file path to each pane from /System/Library/PreferencePanes/ using the open command with slightly different syntax (replace /Path/To/Pane with your desired pane):

open -b com.apple.systempreferences /Path/To/Pane

Preference Panes

Below are all the panes that display on most Macs running 10.15 Catalina but there are a few that are ommitted that are available on later versions of Apple hardware or installed plugins. If the pane supports being opened with URL then it is listed, otherwise you can use the path.

Apple ID Pane

/System/Library/PreferencePanes/AppleIDPrefPane.prefPane

Family Sharing Pane

/System/Library/PreferencePanes/FamilySharingPrefPane.prefPane

General Pane

/System/Library/PreferencePanes/Appearance.prefPane

Desktop & Screen Saver Pane

/System/Library/PreferencePanes/DesktopScreenEffectsPref.prefPane

Dock Pane

/System/Library/PreferencePanes/Dock.prefPane

Mission Control Pane

/System/Library/PreferencePanes/Expose.prefPane

Siri Pane

com.apple.preference.speech
/System/Library/PreferencePanes/Speech.prefPane

Spotlight Pane

/System/Library/PreferencePanes/Spotlight.prefPane

Language & Region Pane

/System/Library/PreferencePanes/Localization.prefPane

Notifications Pane

com.apple.preference.notifications
open -b com.apple.systempreferences /System/Library/PreferencePanes/Notifications.prefPane

Internet Accounts Pane

/System/Library/PreferencePanes/InternetAccounts.prefPane

Users & Groups Pane

/System/Library/PreferencePanes/Accounts.prefPane

Accessibility Pane

com.apple.preference.universalaccess
/System/Library/PreferencePanes/UniversalAccessPref.prefPane
  • Display com.apple.preference.universalaccess?Seeing_Display

  • Zoom com.apple.preference.universalaccess?Seeing_Zoom

  • VoiceOver com.apple.preference.universalaccess?Seeing_VoiceOver

  • Descriptions com.apple.preference.universalaccess?Media_Descriptions

  • Captions com.apple.preference.universalaccess?Captioning

  • Audio com.apple.preference.universalaccess?Hearing

  • Keyboard com.apple.preference.universalaccess?Keyboard

  • Mouse & Trackpad com.apple.preference.universalaccess?Mouse

  • Switch Control com.apple.preference.universalaccess?Switch

  • Dictation com.apple.preference.universalaccess?SpeakableItems

Screen Time

com.apple.preference.screentime
/System/Library/PreferencePanes/ScreenTime.prefPane

Extensions Pane

/System/Library/PreferencePanes/Extensions.prefPane

Security & Privacy Pane

Tip: The "Advanced" anchor will initially open S&P pane to your last used tab (General, FileValut, Firewall, Privacy)but if the pane is already open it triggers a the panel unlock wherever the user may be at in the Security and Privacy pane. So, if you want them to enable a specific Privacy setting, open the desired Privacy anchor first (e.g. ?Privacy_Contacts) and then open the Advanced anchor (?Advanced) to prompt the user password to unlock the preference pane.

Main Tabs

com.apple.preference.security
/System/Library/PreferencePanes/Security.prefPane
  • General com.apple.preference.security?General

  • Advanced com.apple.preference.security?Advanced

  • FileVault com.apple.preference.security?FDE

  • Firewall com.apple.preference.security?Firewall

  • Privacy Main com.apple.preference.security?Privacy

Privacy Anchors

  • Location Services com.apple.preference.security?Privacy_LocationServices

  • Contacts com.apple.preference.security?Privacy_Contacts

  • Calendars com.apple.preference.security?Privacy_Calendars

  • Reminders com.apple.preference.security?Privacy_Reminders

  • Photos com.apple.preference.security?Privacy_Photos

  • Camera com.apple.preference.security?Privacy_Camera

  • Microphone com.apple.preference.security?Privacy_Microphone

  • Speech Recognition com.apple.preference.security?Privacy_SpeechRecognition

  • Accessibility com.apple.preference.security?Privacy_Accessibility

  • Input Monitoring Not Available

  • Full Disk Access com.apple.preference.security?Privacy_AllFiles

  • Files and Folders Not Available

  • Screen Recording Not Available

  • Automation com.apple.preference.security?Privacy_Automation

  • Analytics and Improvements com.apple.preference.security?Privacy_Diagnostics

  • Advertising com.apple.preference.security?Privacy_Advertising

Software Update Pane

/System/Library/PreferencePanes/SoftwareUpdate.prefPane

Network Pane

/System/Library/PreferencePanes/Network.prefPane

Bluetooth Pane

/System/Library/PreferencePanes/Bluetooth.prefPane

Sound Pane

/System/Library/PreferencePanes/Sound.prefPane

Printers & Scanners Pane

/System/Library/PreferencePanes/PrintAndFax.prefPane
/System/Library/PreferencePanes/PrintAndScan.prefPane

Keyboard Pane

/System/Library/PreferencePanes/Keyboard.prefPane

  • Dictation com.apple.preference.speech?Dictation

Trackpad Pane

/System/Library/PreferencePanes/Trackpad.prefPane

Mouse Pane

/System/Library/PreferencePanes/Mouse.prefPane

Displays Pane

/System/Library/PreferencePanes/Displays.prefPane

Energy Saver Pane

/System/Library/PreferencePanes/EnergySaver.prefPane

Date & Time Pane

/System/Library/PreferencePanes/DateAndTime.prefPane

Sharing Preference Pane

com.apple.preferences.sharing
/System/Library/PreferencePanes/SharingPref.prefPane
  • Screen Sharing com.apple.preferences.sharing?Services_ScreenSharing

  • File Sharing com.apple.preferences.sharing?Services_PersonalFileSharing

  • Printer Sharing com.apple.preferences.sharing?Services_PrinterSharing

  • Remote Login com.apple.preferences.sharing?Services_RemoteLogin

  • Remote Management com.apple.preferences.sharing?Services_ARDService

  • Remote Apple Events com.apple.preferences.sharing?Services_RemoteAppleEvent

  • Internet Sharing com.apple.preferences.sharing?Internet

  • Bluetooth Sharing com.apple.preferences.sharing?Services_BluetoothSharing

Time Machine Pane

/System/Library/PreferencePanes/TimeMachine.prefPane

Startup Disk Pane

/System/Library/PreferencePanes/StartupDisk.prefPane

Profiles Pane

/System/Library/PreferencePanes/Profiles.prefPane

@NSExceptional
Copy link

Anyone know if there's a pane ID for the keyboard shortcuts submenu of keyboard settings?

@gingerbeardman
Copy link

gingerbeardman commented Feb 25, 2024

Anyone know if there's a pane ID for the keyboard shortcuts submenu of keyboard settings?

I guessed this using the info presented above.

open "x-apple.systempreferences:com.apple.preference.keyboard?Shortcuts"

To manage Keyboard Shortcuts > App Shortcuts, I use an app called CustomShortcuts https://www.houdah.com/customShortcuts/

@NSExceptional
Copy link

@gingerbeardman Sick! Didn't know that was a thing! Always wanted autocomplete for menu bar items like that.

Anyway, nice guess! Thanks!

@gingerbeardman
Copy link

@NSExceptional in any app you can also type Cmd+/ to get to Help > Search, and then you can type in the text of any menu item and invoke it directly. For times when there isn't a shortcut or you can't remember it.

And there's an app called FinBar that might be useful depending on how you work. https://www.roeybiran.com/apps/finbar

@decivilizator
Copy link

Is there a way to target Function Keys pane, since x-apple.systempreferences:com.apple.Keyboard-Settings.extension?Shortcuts opens Modifier Keys view?

function-keys-pane

@gingerbeardman
Copy link

gingerbeardman commented Mar 8, 2024

Is there a way to target Function Keys pane, since x-apple.systempreferences:com.apple.Keyboard-Settings.extension?Shortcuts opens Modifier Keys view?

After that one opens to Modifier Keys simply press up cursor to get to Function Keys. Easy.

Edit: figured it out, using the info at this page: https://gist.github.com/dvessel/2b6ad97b2da16d445671b39618221aab

open "x-apple.systempreferences:com.apple.Keyboard-Settings.extension?FunctionKeys"

@decivilizator if you change that Function Keys preference often, you might find the app Fluor useful. It allows you to set that preference per-app so you can set and forget. https://github.com/Pyroh/Fluor

@decivilizator
Copy link

@gingerbeardman That's the one! Thanks, Matt!

@drandomuser
Copy link

Can we pass parameters through this URL to update text-replacement section automatically?

open "x-apple.systempreferences:com.apple.Keyboard-Settings.extension?TextReplacements"

@gingerbeardman
Copy link

gingerbeardman commented Apr 16, 2024

No, but you could most likely AppleScript that sort of change.

Easily because it can all be done with the keyboard, no need to do any UI scripting.

open "x-apple.systempreferences:com.apple.Keyboard-Settings.extension?TextReplacements"

  1. type the shortcut "replace" text you want to change
  2. type enter to change that
  3. type tab to move to the "with"
  4. type the new text
  5. type enter

repeat steps 1-5 for any further changes

type escape to get out

@xmddmx
Copy link

xmddmx commented Jun 10, 2024

I'm noticing that in macOS Sequoia (first developer beta) the anchors are somewhat flaky, e.g.

open "x-apple.systempreferences:com.apple.settings.PrivacySecurity?Privacy_Accessibility"
doesn't always switch to the Accessibility sub-pane.

However, simply running it twice with a 1 second delay seems to work:

open "x-apple.systempreferences:com.apple.settings.PrivacySecurity?Privacy_Accessibility" ; sleep 1 ; open "x-apple.systempreferences:com.apple.settings.PrivacySecurity?Privacy_Accessibility"

@Kamik423
Copy link

With iOS 18 / macOS 15 there is now AcessivilitySettings.openSettings(for:)

https://developer.apple.com/documentation/accessibility/accessibilitysettings/opensettings(for:)?changes=latest_minor

@luckman212
Copy link

@gingerbeardman Any idea how to get directly to the App Shortcuts pane on 14.5?

image

x-apple.systempreferences:com.apple.Keyboard-Settings.extension?Shortcuts just takes me to Modifier Keys ...

@gingerbeardman
Copy link

No sorry

@luckman212
Copy link

No prob. Seems like just a bug.

@ppravinkumar
Copy link

in macOS Sequoia How to Open the Endpoint Security Extensions Pane. is there any anchor available for

open "x-apple.systempreferences:com.apple.ExtensionsPreferences"

Screenshot 2024-07-31 at 6 30 36 PM

@eLDeus
Copy link

eLDeus commented Aug 17, 2024

Anyone know if there's a pane ID for the keyboard shortcuts submenu of keyboard settings?

I guessed this using the info presented above.

open "x-apple.systempreferences:com.apple.preference.keyboard?Shortcuts"

To manage Keyboard Shortcuts > App Shortcuts, I use an app called CustomShortcuts https://www.houdah.com/customShortcuts/

You're my hero, live forever dude ;)

@xmddmx
Copy link

xmddmx commented Aug 31, 2024

In macOS Sonoma and Sequoia, is there any way to reveal the Screen Saver pane, AND reveal the list of "Other" screensavers?

I wonder if this could be done using AppleScript instead?

@gingerbeardman
Copy link

gingerbeardman commented Sep 1, 2024

@xmddmx yes, of course

You'd have to:

  1. open "x-apple.systempreferences:com.apple.ScreenSaver-Settings.extension"
  2. scroll to bottom of view to make sure Other is visible (so we'll be able to see the things we want to reveal)
  3. click the Other > Show All button

AppleScript

We can do steps 2 & 3. Edit using Script Editor and save as other.scpt

activate application "System Settings"
tell application "System Events"
	tell application process "System Settings"
		-- set scroll bar position
		set value of value indicator 1 of scroll bar 1 of scroll area 2 of group 1 of group 2 of splitter group 1 of group 1 of window "Screen Saver" to 1
		-- click Other's Show All button
		click button 6 of UI element 1 of scroll area 2 of group 1 of group 2 of splitter group 1 of group 1 of window "Screen Saver"
	end tell
end tell

UI Browser

Use UI Browser (free) to get the reference to the scroll bar and button.

It allows you to copy the AppleScript to "click" or "set the value" of an element you choose using the mouse or by navigating the view hierarchy column browser. So, I didn't write any of the AppleScript code above, I just copied and pasted two things.

Screen shot 2024-09-01 at 17 54 04

Terminal

open "x-apple.systempreferences:com.apple.ScreenSaver-Settings.extension";sleep 1;osascript other.scpt

but if you're using AppleScript you might as well use it to open System Settings, switch to the Screen Saver section, then you would avoid the awkward sleep 1 wait on the terminal. I'll leave that to you.

@xmddmx
Copy link

xmddmx commented Sep 1, 2024

Thanks! Trying your script I'm getting an error, but I can probably figure out what the problem is (this is testing on Intel 14.6.1):

System Events got an error: Can’t get button 6 of UI element 1 of scroll area 2 of group 1 of group 2 of splitter group 1 of group 1 of window "Screen Saver" of application process "System Settings". Invalid index.

@gingerbeardman
Copy link

gingerbeardman commented Sep 2, 2024

The AppleScript I provided will only work if System Settings has been opened to the correct page (which I do with the open... command in the first part of the Terminal incantation). It will not work in isolation.

That's as much support as I can give you on this. Cheers!

@xmddmx
Copy link

xmddmx commented Sep 3, 2024

Testing in macOS Sonoma 14.6.1 (Intel) using UI Browser app, I found the difference in my script and your script:

Yours:
click button 6 of UI element 1 of...
Mine:
click button 6 of UI element 2 of...

I'm not sure why there is a difference, but in any case here's a working script for Sonoma 14.6.1:

activate application "System Settings"
tell application "System Events"
	tell application process "System Settings"
		-- set scroll bar position
		set value of value indicator 1 of scroll bar 1 of scroll area 2 of group 1 of group 2 of splitter group 1 of group 1 of window "Screen Saver" to 1
		-- click Other's Show All button
		click button 6 of UI element 2 of scroll area 2 of group 1 of group 2 of splitter group 1 of group 1 of window "Screen Saver"
	end tell
end tell

@gingerbeardman
Copy link

gingerbeardman commented Sep 3, 2024

But I'm on Sonoma 14.6.1 (Apple silicon) and as I showed my script works for me.

You can use UI Browser to see why there's a difference. My screenshot has the hierarchy that I used to get that line of code. The column "Level 7: 3 elements" shows that part of the hierarchy.

There's no need to be uncertain, or have to guess, the information is all available. What do you see in the hierarchy?

I guess the UI component layout of that window could vary bertween Intel and Apple silicon, comparing the hierarch would tell us.

@xmddmx
Copy link

xmddmx commented Sep 3, 2024

Here's what I see:
image

I think I see the issue.

On my system, I have the screensaver set to "Never" and this gives an additional UI element:

image

If I change the settings so this disappears, then I have the same hierarchy as you do.

@gingerbeardman
Copy link

gingerbeardman commented Sep 3, 2024

There we go then. So your code snippet is for people who have Screen Saver Timing set to "Never". Mine is for the "default" macOS user.

This is a classic example why UI scripting is frowned up and not really a good universal solution.

There are alternate ways of addressing a user interface element than using the index number scheme, but they are more complicated.

  • asking for "last ui element of a certain type", which would return the correct element in both "never" and "default" setups, I can't remember the AppleScript syntax off-hand
  • iterate through each element looking at a specific property until it matches what you are looking for (example) this is slower and more like programming
  • the role of the element we really want is AXOpaqueProviderGroup

Also, I'm interested why you need this functionality? Are you distributing a screensaver and want an easier way for users to find it after install?

@xmddmx
Copy link

xmddmx commented Sep 3, 2024

Also, I'm interested why you need this functionality? Are you distributing a screensaver and want an easier way for users to find it after install?

Ideally, yes, this would be for a custom screensaver installer. The problem with this AppleScript solution is that calling into System Events requires the Accessibility permission, which means the installer would need to have extra permissions granted to function, so this is probably not a feasible solution for my use case.

@buddax2
Copy link

buddax2 commented Sep 10, 2024

in macOS Sequoia How to Open the Endpoint Security Extensions Pane. is there any anchor available for

open "x-apple.systempreferences:com.apple.ExtensionsPreferences"

Screenshot 2024-07-31 at 6 30 36 PM

Did you find a way to open the modal view?

@gingerbeardman
Copy link

You might be able to dig into it using this technique: https://www.macosadventures.com/2022/02/10/identifying-system-preferences-panes/

@buddax2
Copy link

buddax2 commented Sep 10, 2024

You might be able to dig into it using this technique: https://www.macosadventures.com/2022/02/10/identifying-system-preferences-panes/

That didn't work but I figured out how to open the needed modal view with this script:

activate application "System Settings"
tell application "System Events"
	tell application process "System Settings"
		-- click Other's Show All button
		click button 2 of group 3 of scroll area 1 of group 1 of group 2 of splitter group 1 of group 1 of window "Login Items & Extensions"
	end tell
end tell

But still need to figure out how to open "Login Items & Extensions" window.

@gingerbeardman
Copy link

Be aware some people (like me) don't have the items you're looking for, so this results in an error.

@kristinka491
Copy link

You might be able to dig into it using this technique: https://www.macosadventures.com/2022/02/10/identifying-system-preferences-panes/

That didn't work but I figured out how to open the needed modal view with this script:

activate application "System Settings"
tell application "System Events"
	tell application process "System Settings"
		-- click Other's Show All button
		click button 2 of group 3 of scroll area 1 of group 1 of group 2 of splitter group 1 of group 1 of window "Login Items & Extensions"
	end tell
end tell

But still need to figure out how to open "Login Items & Extensions" window.

I found this one to open "Login Items & Extensions", but can't find the way to open Endpoint Security Extension modal itself.
"x-apple.systempreferences:com.apple.LoginItems-Settings.extension?Network"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment