Using command line how to open a specific section of GUI System Preferences?
It is possible to open a specific section (sub section) of the GUI System Preferences via command line terminal?
Example:
If I want to open just the main System Preferences window, I just run open /Applications/System\ Preferences.app/
but what about (for example) I want to open the System Preferences > Security and Privacy section?
Thank you so much in advance for your help.
You have to know where the actual PreferencePane resides. Just supply the full path to the section you want.
For Apple supplied PreferencePanes it's easy:
open /System/Library/PreferencePanes/Security.prefPane
opens your desired System Preferences > Security and Privacy.
Other preferencePanes might be found at /Library/PreferencePanes
or ~/Library/PreferencePanes
You can use the following AppleScript:
tell application "System Preferences"
reveal pane "Security\n& Privacy"
end tell
In the shell, you'll need to wrap this inside an osascript
command. The best solution will depend on what your exact workflow is, e.g. whether you want to do this as part of a script.