How to add separators (vertical lines) in the dock?

Solution 1:

You can put a spacer in the dock that separated documents from the trash. This is not the same as the vertical line, but may help you. From the terminal type or paste:

defaults write com.apple.dock persistent-others -array-add '{tile-data={}; tile-type="spacer-tile";}'

after that run

killall Dock

The Dock will disappear briefly but reappear with new setting. This spacer is like an icon and can be moved along the Dock by clicking and moving the spacer to where you want it. The source I included has methods for customized spacers. It may show you how to add a vertical line.

Removing them is similar to removing any other icon from the dock. Click, hold and drag it out.

Source https://www.lifewire.com/add-custom-and-standard-doc-spacers-to-mac-2260861