Short answer: the Dock is not resizing. macOS is storing one
tilesize and drawing it on displays with different pixel densities, so the same number
looks bigger on one screen than the other.
Locking the size stops the number itself from being changed, which is the part you can actually
control: defaults write com.apple.dock size-immutable -bool true; killall Dock
The Dock has one size setting for the whole Mac, not one per display. tilesize is a
number of points, and a point is not a fixed number of pixels. On a Retina laptop screen a 48 point
icon is drawn across roughly twice as many pixels as on a 1080p monitor, so the Dock looks correct on
one and wrong on the other, without the stored value ever changing.
That is why the Dock appears to resize itself the moment you plug in or unplug a monitor: the number stayed put, the canvas changed underneath it.
There is a second, separate problem, and this is the one worth locking. When the Dock lands on a screen of a different size, its maximum width changes with it. A Dock that fits comfortably across a 27 inch monitor does not fit across a laptop screen, so macOS shrinks the icons to make them fit. Come back to the big monitor and they do not always return to where they were.
Every accidental brush of the divider while it is on the wrong screen writes a new
tilesize, and that value is the one that follows you back.
Pick the size on the display you use most, then read the value so you can put it back later:
defaults read com.apple.dock tilesize
Write that number down. It is an integer, normally between 16 and 128.
defaults write com.apple.dock size-immutable -bool true
killall Dock
The size slider in System Settings stops responding and the divider stops resizing. The Dock still
scales visually between displays of different densities, because that is macOS drawing it, but the
stored value can no longer drift. To release it, swap true for false.
If the Dock jumping between monitors is the real annoyance, size is only half of it. See how to keep the Dock on one screen, which covers what macOS does and does not let you pin.
tilesize above 128. The Dock accepts it from the command
line and then clamps it on the next launch. It is not a hidden larger size.defaults write com.apple.dock size-immutable -bool false
defaults write com.apple.dock tilesize -int 48
killall Dock
Use whichever number you noted in step one. If you never noted one,
defaults delete com.apple.dock tilesize returns the Dock to the macOS default rather than
a guess.
No.
size-immutable pins tilesize only. Magnification and
largesize stay adjustable unless you lock them separately, and locking the size while
magnification is on is a common way to get a Dock that still looks like it is moving.
No. The lock stops the value being written; it does not stop macOS drawing the Dock at whatever scale a display needs. Presenting works exactly as before.
All of them that matter.
size-immutable has worked for over fifteen years and still works on macOS 26. The
settings pane moved to System Settings › Desktop & Dock, which is where the grayed out
slider will be.
If you would rather not keep a list of commands, Still Dock is the same four settings as switches, and it remembers the Dock you had before you locked it. The size lock is free.