How to add/remove MacOS Dock separator

There are 2 ways to do it.

Using CLI

It is not possible to add a native, non-empty vertical line separator to the macOS Dock using standard commands or settings. That means the only empty space could be added into Dock as a organizer. This approach uses command line:

Add separator

defaults write com.apple.dock persistent-apps -array-add '{ "tile-type" = "spacer-tile"; }'
killall Dock

Remove separator

To remove separator just Right click on it and choose “Remove” in context menu

Using workaround

  1. Create empty file and change extension for ‘.app’
  2. Move this file into appropriate location (e.g. main Application folder)
  3. Change application icon for an “Vertical bar” or something you like to see as an separator image
  4. Put this Application onto Dock