macos-defaults
                                
                                
                                
                                    macos-defaults copied to clipboard
                            
                            
                            
                        Add a spacer to the Dock
- [x] I made sure this command is not in the commands list
 - [x] I searched and didn't find this command in the listed issues
 - [x] I know this 
defaultscommand exists - [x] I know this command works on macOS current version
 - [ ] I know this command is deprecated on macOS current version
 
- Folder: Dock
 - Command:
 
defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="spacer-tile";}' && Killall Dock
defaults write com.apple.dock persistent-others -array-add '{tile-data={}; tile-type="spacer-tile";}' && Killall Dock
- Argument: string
 
Add a spacer to the dock. You can simply drag this spacer just like dragging an app icon. And dragging it out of the Dock would remove it.
There's also a 3rd option to only add a smaller / tiny gap element to the Dock:
defaults write com.apple.dock persistent-apps -array-add '{"tile-type"="small-spacer-tile";}'
Note: all the commands here still work up to macOS 14.5 Sonoma 👍