Hi,
How do i open the System Preferences Panel on a particular tab?
Shell1.Execute ("/usr/bin/open -b com.apple.systempreferences /System/Library/PreferencePanes/Security.prefPane")
“Security.prefPane**?Privacy**” seems to no longer work.
Thanks
TomE1
(TomE)
May 16, 2022, 7:47am
2
Use AppleScript.
E.g. in ScriptEditor use
tell application "System Preferences" to get panes
to get a list of alla available panels.
Now you can navigate to a specific panel with a name like
tell application "System Preferences" to reveal pane id "com.apple.preference.displays"
In case you want to still use the shell you may use e.g.
osascript -e 'tell application "System Preferences" to activate' -e 'tell application "System Preferences" to reveal pane id "com.apple.preference.displays"'
Using
System.GoToURL("x-apple.systempreferences:com.apple.preference.security?Privacy_Automation")
works fine.
1 Like
Mike_D
(Mike D)
May 16, 2022, 1:55pm
4
A third way:
dim f as folderItem = SpecialFolder.System.child("Library").child("PreferencePanes").child("Security.prefPane")
if f <> nil and f.exists then
dim sh as new shell
sh.Execute "open " + f.ShellPath
end if
1 Like
This is what I use. You can call the prefPane directly and the system will do the right thing.
Mike_D
(Mike D)
May 16, 2022, 1:59pm
6
Also, I just tried your command in my Terminal (macOS 12.3.1) and it works fine:
/usr/bin/open -b com.apple.systempreferences /System/Library/PreferencePanes/Security.prefPane
@Mike_D @Tim_Jones Does this technique make Apple Security complain that you’re trying to access a folder in /System/Library?
I learned the way @Beatrix_Willius shared, and somewhere buried in my reference notes is a list of the different locations that are valid.
1 Like
Mike_D
(Mike D)
May 16, 2022, 2:25pm
8
Good point: for me it does not cause a security warning, but I have previously set Terminal with Full Disk Access…
I was provided this amazing reference by Norman
macOS_SytemPrefs.md
# 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:
```bash
tell application "System Preferences"
set CurrentPane to the id of the current pane
set the clipboard to CurrentPane
This file has been truncated. show original
4 Likes
Yes it’s work fine but, i want open to a SPECIFIC tab ! Sample : “General” tab, “Filevault” tab, “Firewall” tab or “Privacy” tab.
Thanks
Thanks you very much work fine ! But how do I get the names of the other tabs? FileVault, Firewall and General tab?
Where do we find the list?
Scott_C
(Scott C)
August 26, 2024, 3:46am
15
Thank you @Denis_DUBOIS & @Beatrix_Willius , this is very useful.
I wanted to be able to open the General > Languages & Region pane, but com.apple.Localization
is listed as not usable with System.GoToURL
. Also tested in code that it doesn’t work.
So I experimented and combined x-apple.systempreferences:
& com.apple.Localization
together and it works
System.GotoURL("x-apple.systempreferences:com.apple.Localization")