Mac OS X

Stop The Dock From Rearranging Itself in macOS

By default, the dock automatically rearranges spaces based on the last one used. I prefer to arrange them myself. To disable that behavior, set the mru-spaces boolean to false in com.apple.dock as follows:

defaults write com.apple.dock mru-spaces -bool false