Brief #3 - macOS Dock Settings on the Terminal

Intro

All – probably more – settings for the Dock found in the System Settings.app in macOS can be adjusted using the command line. This is particularly helpful for automation of course.

IMHO the following selection of commands is more than enough for most settings one needs.

Commands

Note:
Run killall Dock after any of the commands for the changes to take effect.

Dock’s Position

# Possible options 'bottom', 'left' or 'right'
defaults write com.apple.dock orientation bottom

Dock size

# Integer... In my case 32 is the "magic" number
defaults write com.apple.dock tilesize -int 32

Dock magnification

# Possible options 'yes' or 'no'
defaults write com.apple.dock magnification -boolean yes

Auto hide the Dock

# Possible options 'yes' or 'no'
defaults write com.apple.dock autohide -boolean yes

Auto hide delay

# Reasonable values between 0 and 0.9 (ms). – Snaller number = faster appearance
defaults write com.apple.dock autohide-time-modifier -float 0
defaults write com.apple.dock autohide-delay -float 0

Reset to factory default

# This removes all the settings. macOS recreates them with factory defaults
defaults delete com.apple.dock

Bonus

macOS does not have an elegant option for managing the items in the dock.

However there is a FOSS tool by the name dockutil for that:

dockutil is a command line utility for managing macOS dock items. It is currently written in Swift.