Would rather not type them out? Use the free command generator. Want a switch instead of a command? Still Dock locks your Mac's Dock from the menu bar.
macOS can lock the Dock. It has been able to for years. Apple simply never put the controls in System Settings.
There are four working settings. All four are listed below, with the one that is widely repeated online but does nothing.
Each is a single line in Terminal. Open Terminal from Applications then Utilities, paste a line, press Return.
The divider stops responding, and the size slider in System Settings greys out.
defaults write com.apple.dock size-immutable -bool true; killall Dock
The Dock stays on the edge you chose. Bottom, left or right.
defaults write com.apple.dock position-immutable -bool true; killall Dock
Apps can no longer be dragged out, dropped in, or rearranged. Useful on a shared or family Mac, where the usual complaint is an app that has silently vanished from the Dock.
defaults write com.apple.dock contents-immutable -bool true; killall Dock
Pins the auto-hide setting so it cannot be flipped, by accident or by another app. This one is rarely documented.
defaults write com.apple.dock autohide-immutable -bool true; killall Dock
Run the same line with false in place of true:
defaults write com.apple.dock size-immutable -bool false; killall Dock
To clear all four at once, and nothing else:
defaults delete com.apple.dock size-immutable
defaults delete com.apple.dock position-immutable
defaults delete com.apple.dock contents-immutable
defaults delete com.apple.dock autohide-immutable
killall Dock
You will find magnification-immutable repeated across forums and listicles as a fifth lock. We tested it on macOS 26. It does nothing. The setting is written, no error appears, and magnification remains fully adjustable in System Settings.
If you want magnification held steady, there is no preference for it. Turn it off instead.
killall Dock is not optional. Writing the preference on its own greys out the control in System Settings but the Dock keeps letting you resize it until it restarts. Nearly every guide that leaves this out produces a lock that appears to fail.To see whether a lock is on:
defaults read com.apple.dock size-immutable
1 means locked, 0 means unlocked, and an error saying the key does not exist means it was never set.
If you set your Dock once and never change it, run the commands and you are done. They cost nothing and they hold.
They start to grate when your Dock is something you actually adjust. Every change means finding the commands again, unlocking, adjusting, relocking. There is no record of what you had, so a lock applied at the wrong moment freezes the wrong size permanently. And none of it follows you to a new Mac.
Locking the Dock with Still Dock is these same four settings as four switches in the menu bar. It records the Dock you had before each lock and restores it when you unlock, quit, or delete the app, so nothing is ever stuck. You can try how it behaves in your browser first.
Using more than one screen? The Dock also jumps between them, which is a separate problem with its own fixes: how to keep the Mac Dock on one screen.
Yes. These are documented macOS preferences, the same ones IT departments use to standardise Macs. Nothing is patched or modified, and every one of them reverses with a single command.
No. These write to your own user preferences, so no password is required. That also means any user can undo them for their own account.
No. These settings only prevent changes. They have no effect on performance.
Not with these. Which display shows the Dock is governed by Mission Control, not by these preferences. Turning off Displays have separate Spaces keeps the Dock on one screen, at the cost of per-display full screen apps.