macos-defaults
macos-defaults copied to clipboard
Edit items in 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
defaults
command 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 " "
-
Examples: Remove all : defaults write com.apple.dock 'persistent-apps' -array " "
Add app : defaults write com.apple.dock 'persistent-apps' -array-add "<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>FULL APP PATH</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>"
Add folder : defaults write com.apple.dock 'persistent-others' -array-add '<dict><key>tile-data</key><dict><key>arrangement</key><integer>0</integer><key>displayas</key><integer>0</integer><key>file-data</key><dict><key>_CFURLString</key><string>FULL ITEM PATH</string><key>_CFURLStringType</key><integer>0</integer></dict><key>preferreditemsize</key><integer>-1</integer><key>showas</key><integer>0</integer></dict><key>tile-type</key><string>directory-tile</string></dict>'
Options for "displayas" are 0 for stack view or 1 for folder icon, options for "showas" are 0 for auto, 1 for fan view, 2 for grid view or 3 for list view.
Maybe it also makes sense to reference to dockutil which is pretty flexible to manage the dock items.