Posted on 12-07-2011 10:58 AM
I disabled login/logout policies in the interests of speeding things up and
as a result I had to change the logic of a few policies. On the student
machines for docks I was just using an offline available policy at every
login to install a new dock plist and then killall dock (also in Lion this
causes an ugly gray wallpaper flash). This obviously would not work anymore
so I finally got to hop on the dockutil bandwagon. :)
Shortly after playing around with it a bit I realized that dockutil will
happily allow you to add the same item to the dock multiple times. When I
really need it I will write a script that checks for the existence of an
item and then adds it but I came up with this just to check by hand while
testing and thought it might be useful to someone else.
This is the command & output from 10.6.8
$ /usr/libexec/PlistBuddy -c Print /path/to/com.apple.dock.plist | awk
'/CFURLString =/{ print $3,$4 | "sort" }'
/Applications/Safari.app/
/Applications/Self Service.app/
/Applications/System Preferences.app/
/Applications/Utilities/Activity Monitor.app/
/Applications/Utilities/Console.app/
/Applications/Utilities/Grab.app/
/Applications/Utilities/Network Utility.app/
/Applications/Utilities/System Profiler.app/
/Applications/Utilities/Terminal.app/
/System/Library/CoreServices/Directory Utility.app/
/System/Library/CoreServices/Screen Sharing.app/
/System/Library/PreferencePanes/Accounts.prefPane/
/System/Library/PreferencePanes/StartupDisk.prefPane/
/Users/test/Downloads/
afp://some.fileserver.org/springer
You can remove | "sort" if you want to see things in the order in which
they appear on the dock. Fields $3 and $4 are included because getting awk
to print from a given field to the end of the line is nasty business. :D
Here is the command and output in 10.7.2
$ /usr/libexec/PlistBuddy -c Print
~/Library/Preferences/com.apple.dock.plist | awk '/CFURLString =/{ print $3
}'
file://localhost/Applications/Casper%20Suite/
file://localhost/Users/ryan/Downloads/
file://localhost/Users/ryan/Dropbox/
file://localhost/Applications/Firefox.app/
file://localhost/Applications/Google%20Chrome.app/
file://localhost/Applications/Safari.app/
file://localhost/System/Library/CoreServices/Screen%20Sharing.app/
file://localhost/Applications/Remote%20Desktop.app/
file://localhost/Applications/CoRD.app/
file://localhost/Applications/MacVim.app/
file://localhost/Applications/nvALT.app/
file://localhost/Applications/Utilities/Terminal.app/
Also interesting to note is that when the output is not sorted in 10.6 the
items appear in dock order from left to right or top to bottom. In Lion, at
least on my machine, the document/folder items appear first and the
applications second but each is in dock order for the respective type.
Ryan M. Manly
Glenbrook High Schools
P.S. if you are still not using this awesome tool yet make sure you get it
from Kyle's github page <https://github.com/kcrawford/dockutil> and not the
top hit that Google gives you. That one throws errors in 10.6.8 :(