I like to organize my macOS/OS X dock by arranging similar app icons together into groups and then separating the groups visually with spaces using a hidden dock feature called spacer tiles. If you have a lot of apps on your Dock, spacer tiles can make it easier to find the right app quickly and also make your dock look less cluttered.
Available in two sizes (small and normal), a spacer tile can be added to your dock by running a special command at a terminal prompt.
When the the command is run, the space will added to dock's properly list and will then kill the dock process to force the new property to be loaded. The space should be visible on the far right side of the static part of the Dock. From there, you can drag the space to wherever you want it.
If you would like multiple spacer tiles on your dock, the command can be repeated as many times as you want. You can even put multiple spacer tiles right next to each other to create a mega spacer!
How to create a normal size space
Open up a Terminal window. If you don't already have Terminal open, Hold down the "⌘ command" key and spacebar to bring up Spotlight search, key in terminal
until Terminal.app is displayed and hit Return.
Then copy and paste the following into terminal and run it:
defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}' && killall Dock
How to create a small size space
Similar to above, copy and paste the following into terminal and run it:
defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="small-spacer-tile";}' && killall Dock
How to delete a space
If you created too many spaces, want to swap it out for a different size, or would simply like to delete the space you created, just drag it over to the trash bin to remove it.