Posted on 02-01-2015 09:12 PM
Hi All,
Anyone else getting the following when trying to add items to the Dock with the latest Dockutil:
/var/root/Library/Preferences/com.apple.dock.plist does not seem to be a home directory or a dock plist
Started about a week ago... and I can't figure it out for the life of me. And this is using the exact scripts that worked a week ago.
Posted on 02-02-2015 05:30 AM
You're probably running dockutil as root without declaring a home folder to change. It's trying to change the root user's Dock plist, which might not exist yet.
Here's my script to add an arbitrary Dock item to a user's plist at login:
#!/bin/sh
# Adds an arbitrary item to the logging-in (or out) user's Dock
#
# First two Casper variables ignored
# Third Casper variable is username passed at login/logout
# First custom variable ($4) is the path to the item to add
# Second custom variable ($5) is the name of the item in the Dock
# Get logging-in user's home folder
userhome=`eval "echo ~$3/"`
# Add dock item
dockutil --add "$4" --label "$5" --replacing "$5" "$userhome"
I use the "replacing" option so that the same policy can run at each login without producing an error, in order to re-add items that the user might remove inadvertently. I use this for network shares (with the policies limited by AD group).
Feel free to use this and modify to suit your needs.
Posted on 09-11-2015 11:56 AM
This was very helpful! Thanks @bvrooman !!