A great way to manage the OS X Dock in an automated environment is the great use of Kyle Crawford’s GitHub code of DockUtil it’s a python script that you can package and place in the following folder:


Then you can run a shell script to amend or change what you’d like on the dock, a demo script that removes the Apple apps from a standard OS X El Capitain install would look something like:

/usr/local/bin/dockutil --move 'App Store' --position 3 --allhomes
/usr/local/bin/dockutil --remove 'Safari' --allhomes
/usr/local/bin/dockutil --remove 'Mail' --allhomes
/usr/local/bin/dockutil --remove 'Contacts' --allhomes
/usr/local/bin/dockutil --remove 'Calendar' --allhomes
/usr/local/bin/dockutil --remove 'Notes' --allhomes
/usr/local/bin/dockutil --remove 'Reminders' --allhomes
/usr/local/bin/dockutil --remove 'Photos' --allhomes
/usr/local/bin/dockutil --remove 'Messages' --allhomes
/usr/local/bin/dockutil --remove 'FaceTime' --allhomes
/usr/local/bin/dockutil --remove 'iTunes' --allhomes
/usr/local/bin/dockutil --remove 'iBooks' --allhomes
/usr/local/bin/dockutil --remove 'Maps' --allhomes

Modify the script to your needs!.

Let me know you how guy’s get on!