Opening specific panes in system settings using the command line in macOS

I often find myself needing to access specific system settings panes via the command line or a script, but not often enough to remember how to do it. It happens infrequently, yet it’s frustrating every time I have to search for the information again. That’s why I’m writing this article, even though others have already covered the topic – it’s mainly for my own benefit. So yes, this post is a bit selfish, but hopefully, it helps others in the same boat.

If you’re looking for the main information, you can go to Opening with URL Schemes to skip my explanation for why I need it today. With that out of the way, I have been using my iPad as a secondary monitor and it’s great, what’s not great is having to go into displays to extend to the iPad every day. I thought I could automate this process using Keyboard Maestro, which I have now done successfully.

Keyboard Maestro Automation

To download the file you can find it on my Github.

I needed the open specific panes so we can go directly to the displays pane. Then keyboard maestro will wait before moving the mouse to the + button that I screenshot (you should too). It then waits another second before clicking on the name of the device to connect to, this is another screenshot. It then waits another second and quits system settings.

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>"
Zsh

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):

To open a specific pane use the following for the general syntax:

open /System/Library/PreferencePanes/<PANE_NAME>.prefPane
or
open -b com.apple.systempreferences /Path/To/Pane
Zsh

Here’s an example for the Displays pane:

open /System/Library/PreferencePanes/Displays.prefPane
Zsh

Preference Panes

Below are all the panes that display on most Macs running macOS 14 Sonoma 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.

Here’s a list of all the possible panes and their respective commands:

  • Accounts
open /System/Library/PreferencePanes/Accounts.prefPane
Zsh
  • AirDrop and Handoff
open x-apple.systempreferences:com.apple.AirDrop-Handoff-Settings.extension
Zsh
  • Appearance
open /System/Library/PreferencePanes/Appearance.prefPane
Zsh
  • Apple ID
open /System/Library/PreferencePanes/AppleIDPrefPane.prefPane
Zsh
  • Battery
open /System/Library/PreferencePanes/Battery.prefPane
Zsh
  • Bluetooth
open /System/Library/PreferencePanes/Bluetooth.prefPane
Zsh
  • ClassKit (Requires Apple School Manager Apple ID Enrollment)
open /System/Library/PreferencePanes/ClassKitPrerencePane.prefPane
Zsh
  • Classroom Settings (Requires Apple School Manager Apple ID Enrollment)
open /System/Library/PreferencePanes/ClassroomSettings.prefPane
Zsh
  • Date and Time
open x-apple.systempreferences:com.apple.Date-Time-Settings.extension
Zsh
  • Desktop Screen Effects (Wallpaper)
open /System/Library/PreferencePanes/DesktopScreenEffectsPref.prefPane
Zsh
  • CD and DVDs
open /System/Library/PreferencePanes/DigiHubDiscs.prefPane
Zsh
  • Displays
open /System/Library/PreferencePanes/Displays.prefPane
Zsh
  • Dock
open /System/Library/PreferencePanes/Dock.prefPane
Zsh
  • Family Sharing
open /System/Library/PreferencePanes/FamilySharingPrefPane.prefPane
Zsh
  • Internet Accounts
open /System/Library/PreferencePanes/InternetAccounts.prefPane
Zsh
  • Keyboard
open /System/Library/PreferencePanes/Keyboard.prefPane
Zsh
  • Localization
open x-apple.systempreferences:com.apple.Localization-Settings.extension
Zsh
  • Login Items
open x-apple.systempreferences:com.apple.LoginItems-Settings.extension
Zsh
  • Mouse
open /System/Library/PreferencePanes/Mouse.prefPane
Zsh
  • Network (This opens the Wi-Fi pane)
open /System/Library/PreferencePanes/Network.prefPane
Zsh
  • Network (This opens the network pane)
open x-apple.systempreferences:com.apple.Network-Settings.extension
Zsh
  • Notifications
open /System/Library/PreferencePanes/Notifications.prefPane
Zsh
  • Passwords
open /System/Library/PreferencePanes/Passwords.prefPane
Zsh
  • Printers and Scanners
open /System/Library/PreferencePanes/PrintAndScan.prefPane
Zsh
  • Profiles (Opens the privacy and security pane)
open /System/Library/PreferencePanes/Profiles.prefPane
Zsh
  • ScreenTime
open /System/Library/PreferencePanes/ScreenTime.prefPane
Zsh
  • Screen & System Audio Recording (ScreenCapture)
open "x-apple.systempreferences:com.apple.preference.security?Privacy_ScreenCapture"
Zsh
  • Security
open /System/Library/PreferencePanes/Security.prefPane
Zsh
  • Software Update
open x-apple.systempreferences:com.apple.Software-Update-Settings.extension
Zsh
  • Startup Disk
open x-apple.systempreferences:com.apple.Startup-Disk-Settings.extension
Zsh