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 position in the Dock.

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