How to stop macOS dock from moving between monitors

Published Sun Jun 26 2022 20:47:10 GMT+0000 (Coordinated Universal Time)
When you're using multiple displays on macOS, accidentally hovering your mouse near the bottom of any display will cause the dock to relocate.
It annoys me when that happens. I always want my dock on the same display, using the same bit of reserved space. And I want my windows on the other displays to use the full height of the display and not get pushed around by the dock.
It seems like it should be possible to "lock" the dock to a single display and have it stay there, but macOS preferences do not have this option.
I found a simple hack to make the dock less prone to jumping around though.
defaults write autohide-delay -float 5.0; killall Dock
It works by setting the autohide-delay to a large value. This seems counter-intuitive when we don't want the dock to "autohide" at all, but what this actually does is effectively make the dock more reluctant to appear on a different display.
After running this command, you'll have to hold your mouse near the bottom of a screen for several seconds before the dock decides to jump. I find that this happens a lot less now. On the rare occasion it does happen, you can just leave your mouse at the bottom of the original display for a while until it moves back.
Finally, reverting this change can be done easily using the following command:
defaults delete autohide-delay; killall Dock


Most of my photos are licensed under Creative Commons BY-SA 3.0
If you are unsure about your right to use them please contact me.