DockLock Plus CLI
Updated November 17, 2026
Use DockLock Plus from Terminal to move the Dock, keep it on one display while an app is running, or read its status from a script. Use --version to identify your installed build and --help to see which commands it supports.
Getting started
The CLI is included in the app. Set a shell variable to its executable, then use it for the examples below.
docklock="/Applications/DockLock Plus.app/Contents/MacOS/DockLock Plus"
"$docklock" --help
"$docklock" --version
"$docklock" display list
"$docklock" dock status --json
Commands connect to DockLock and start the app if needed. --help and --version work without starting its control service. Running the executable without arguments opens the app normally. If the app is already closed, quit succeeds without starting it.
Commands in the dock, display, rules, settings, shortcuts, and permissions groups accept --json for JSON output. For unattended scripts, complete setup first and append --no-ui to suppress DockLock’s dialogs. You can use both flags once each, in either order, at the end of a command. Script installation is interactive. The launch and quit commands take no options.
Basic Dock locking needs no extra permission. Automatic relocation and requested moves need “Device Control and Data Access” on macOS 27 or later, called “Accessibility” on earlier versions. Reading or changing Dock size, position and auto-hide uses the included Dock Control Script and Automation permission for System Events.
Dock controls
| Command | Behavior |
|---|---|
dock status | Show movement, hiding, pause, detected Dock location, and App Rules state |
dock movement | Read the selected movement mode |
dock movement lock-selected | Lock the Dock to allowed displays |
dock movement follows-mouse | Follow the pointer between compatible displays |
dock movement off | Turn off movement control and suspend App Rules |
dock hide on | Hide the Dock on every display without changing the selected movement mode |
dock hide off | End that hiding override and restore the previous macOS auto-hide preference |
dock hide toggle | Toggle the hiding override |
dock position | Read the Dock’s current position through the script |
dock position bottom | Set position to bottom, left, or right |
dock auto-hide | Read macOS auto-hide through the script |
dock auto-hide on | Set macOS auto-hide to on or off |
dock size | Read the configured size as a percentage from 0 through 100 |
dock size 30 | Set the configured size to 30% |
dock size increase | Increase size by the saved shortcut step |
dock size decrease 5 | Decrease size by 5 percentage points |
dock pause | Pause control for 15 minutes |
dock pause 5 | Pause for 5, 15, or 60 minutes |
dock resume | Resume control without waiting for the pause to expire |
dock hide without a value reports whether the override is on. Movement and App Rules are independent settings. Turning movement off suspends rules without erasing them. Use rules enabled off to disable rules themselves.
End an active hiding override before changing macOS auto-hide. Appearance commands use the same priority and restoration behavior as the app. A matching App Rule can temporarily control the Dock’s appearance. Size percentages represent the configured size range. macOS can fit a crowded Dock into the available space, so its visible icon size may be smaller.
Moving the Dock
"$docklock" display list --json
"$docklock" dock move --display "DISPLAY_ID"
"$docklock" dock move --direction right
"$docklock" dock move --mouse
"$docklock" dock move --active-window
Use left, right, up, or down for direction. A display selector can be its ID, an exact hardware or custom name, or a quoted number such as "#2" from the current arrangement. Use IDs for identical monitors. Ambiguous names return an error.
Relocation requires a bottom Dock, mouse control permission, an available bottom edge on the destination, and a mode that permits manual movement. Resume control and turn off hiding before moving it. Set dock movement lock-selected when leaving Dock Follows Mouse.
Directional movement needs a known source display. If the Dock is hidden and its location cannot be identified, use --display. DockLock checks the saved orientation through the script before accepting that request.
Display preferences
| Command | Behavior |
|---|---|
display list | List connected displays and their IDs |
display current | Report the display currently detected as containing the Dock |
display allow "DISPLAY_ID" | Read whether the display is allowed |
display allow "DISPLAY_ID" on | Allow the display, or use off to exclude it |
display only "DISPLAY_ID" | Allow only this display |
display size "DISPLAY_ID" | Read its saved size preset |
display size "DISPLAY_ID" 40 | Enable a 40% size preset |
display size "DISPLAY_ID" off | Disable its size preset |
display name "DISPLAY_ID" | Read its displayed name |
display name "DISPLAY_ID" "Editing display" | Save a custom name |
display name "DISPLAY_ID" --reset | Restore the hardware name |
Size presets follow the display. DockLock restores the allowed displays for the current arrangement when it has a saved match. An enabled size edit applies when DockLock knows the Dock is on that display. Otherwise it is saved for the next confirmed placement. Pause, hiding, and App Rules retain their usual priority. Disabling a size preset leaves the current Dock size unchanged.
For scripts, copy the persistent id from display list --json. An exact hardware name, custom name or legacy display UUID also works if it matches only one connected display. Numbers such as "#2" follow the current visual order and can change when you rearrange monitors. Custom names are trimmed and limited to 80 characters, as in Settings.
display list --json includes each display’s ID, number, custom and hardware names, geometry, main-display flag, allowed state, bottom-edge compatibility, detected Dock presence, and saved size preset.
App Rules
Rules use application bundle IDs, such as com.apple.Safari. Quote "*" to target any active app.
"$docklock" rules list --json
"$docklock" rules add --app com.apple.Safari --name Safari --size 35
"$docklock" rules add --app "*" --follow-window on
"$docklock" rules enabled on
Adding a rule returns its ID. New rules start enabled, use the active-window trigger, and have no actions unless specified. Adding a rule does not turn on the master App Rules switch.
To keep the Dock on your presentation display while Keynote is running, first find that display in display list. This example uses the second display. The rule remembers its ID even if its number changes.
"$docklock" rules add --app com.apple.iWork.Keynote --trigger running --display "#2"
"$docklock" rules enabled on
"$docklock" rules list --json
Use the ID returned by rules add in place of RULE_ID below. To clear only the display target and keep the rule, use rules update "RULE_ID" --display unchanged. Rule order starts at 1.
"$docklock" rules update "RULE_ID" --size 45
"$docklock" rules update "RULE_ID" --enabled off
"$docklock" rules order "RULE_ID" 1
"$docklock" rules remove "RULE_ID"
"$docklock" rules enabled off
Option for rules add or rules update | Values |
|---|---|
--app | Bundle ID, or "*" for any active app |
--name | Name shown in the rule list |
--enabled | on or off |
--trigger | active-window, window-on-dock-display, or running |
--hide | on or off |
--position | unchanged, bottom, left, or right |
--follow-window | on or off |
--display | A connected display ID, exact name or quoted number, or unchanged to clear the target |
--size | unchanged, or 0 through 100 |
A fixed display works with active-window or running. Following a window requires active-window, as does a rule for "*". Choose either a fixed display or --follow-window on, not both. Both movement actions require hiding to be off and position to be bottom or unchanged. The target must have an available bottom edge.
Specific-app rules take priority over any-app rules. List order breaks ties for movement, position and size. If the target display disconnects or becomes incompatible, DockLock uses the next eligible movement rule or your usual display settings. While a fixed target is in effect, manual moves and changes to allowed displays return exit code 3. Edit or disable that rule to change displays. Your normal display selection is preserved.
rules enabled reads the master switch. In rules list --json, each rule has a targetDisplay and targetDisplayName, both null when no target is set. Read effect.targetDisplay for the target currently in effect. The same information is under appRules in dock status --json.
You can still disable rules if permission is revoked. If restoration fails, DockLock keeps the previous settings and reports that rules are paused. If you edit a rule in Settings while a command is waiting for permission, the command is cancelled instead of overwriting the newer edit.
Advanced settings
"$docklock" settings list --json
"$docklock" settings get enhanced-relocation
"$docklock" settings set enhanced-relocation off
| Setting | Values |
|---|---|
enhanced-relocation | on or off |
alternative-locking | on or off |
launch-at-login | on or off |
hide-dock-icon | on or off |
hide-menu-icon | on or off |
warn-no-displays | on or off |
warn-incompatible-display | on or off |
hide-update-notice | on or off |
unlock-modifier | none, shift, control, option, or command |
wake-retry-seconds | 1 through 120 |
display-change-retry-seconds | 1 through 120 |
These settings correspond to the current app controls. Turning enhanced relocation off is available for troubleshooting. The standard locking method remains the default. Alternative locking requires mouse control permission.
Keyboard shortcuts
"$docklock" shortcuts list --json
"$docklock" shortcuts set mouse-display 46 control+option
"$docklock" shortcuts clear mouse-display
"$docklock" shortcuts arrows control+option
"$docklock" shortcuts arrows off
"$docklock" shortcuts size-step 5
shortcuts set takes an action name, a macOS virtual key code from 0 through 127, and modifiers joined with +. Use command, control, option, and shift. Include Command, Control, or Option. The example assigns Control-Option-M using key code 46.
Use action names from shortcuts list. Arrow shortcuts are configured together with shortcuts arrows. shortcuts size-step sets the default size adjustment from 1 through 100 percentage points. Conflicting or reserved combinations are rejected without replacing the previous shortcut. These commands use the app’s existing shortcut registration.
Permissions and app lifecycle
"$docklock" permissions status --json
"$docklock" permissions install-script
"$docklock" launch
"$docklock" quit
Permission status inspects mouse access and the script installation without running the script or requesting Automation permission. Script installation opens the existing setup flow and cannot be combined with --no-ui. quit uses the normal shutdown flow, including restoration of temporary Dock settings.
Script responses
Successful commands write to standard output. Failures write to standard error and return a nonzero exit code.
| Response | Meaning |
|---|---|
OK | The requested operation completed |
Saved | A setting was stored, with the app’s usual application rules |
Accepted | Relocation was requested, without asserting that macOS completed it |
Paused | The pause was entered |
Queries return their values. Rule creation and updates return the rule ID. With --json, queries return JSON values and mutations return objects, including an ID for rule edits. Errors return an object with error and code.
| Exit code | Meaning |
|---|---|
| 0 | Success |
| 1 | Connection or transport failure |
| 2 | Invalid command or input |
| 3 | Action unavailable in the current state |
| 4 | Permission required or denied |
| 5 | Another operation is busy |
| 6 | Operation cancelled |
| 7 | Operation failed |
Unknown Dock locations and positions are null in the new JSON queries. DockLock does not guess a source display when detection is unavailable. cachedSizePercent in dock status is the last known configured size and can also be null. Use dock size for a fresh script read. pauseUntil is a Unix timestamp while a timed pause is active, zero when no timed pause remains, or negative when resuming failed.
"$docklock" dock size 30 --no-ui --json
"$docklock" display current --json
For Apple Shortcuts, URL commands and Raycast, see the DockLock Plus automation guide.