How to add spaces in the OSX Dock

Most common question I get after presentations, is: “How do you add those spaces in the Dock?”. So to appease the crowd, run this in your terminal:

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

This will add a spacer to the rightmost in the Dock.

Look at those delicious spacers between items.

After being added, you can move the spacers around like any other static icon to get the groups you like, and you remove them by right clicking like any other icon.