Open Preference Pane from command line on El Capitan (Mac OS X 10.11)
Solution 1:
You can open System Preferences using its URL scheme:
open "x-apple.systempreferences:"
You can jump to a specific anchor on a specific pane using:
open "x-apple.systempreferences:com.apple.preference.keyboard?Text"
You can get the list of panes and anchors using AppleScript:
tell application "System Preferences"
set myIds to the id of every pane
set myAnchors to anchors of current pane
end tell
Update: Apple has restricted use of the URL scheme in 10.11. As of this release only preference panes with NSPrefPaneAllowsXAppleSystemPreferencesURLScheme set in their Info.plist can be opened via the URL scheme.
Source: @Matt Stevens answer
Solution 2:
The first command should open System Preferences->Dock. However, if it fails try the following command instead:
open -b com.apple.systempreferences /System/Library/PreferencePanes/Dock.prefPane
-b bundle_indentifier
specifies the bundle identifier for the application to use when opening the file.
Solution 3:
Or use open. For the account pane:
open /System/Library/PreferencePanes/Accounts.prefPane/
Find other preference pane paths in:
/System/Library/PreferencePanes/