I searched quite a while trying to find an answer to this and came up with quite a few answers to different problems that together eventually solved my problem.
So here's the problem. We want to use a Configuration Profile to fully manage the dock for multiple users. This means app icons (both Apple and third party) as well as manage the files and folders found on the right side of the dock. Folders such as "Documents" and "Downloads". However, they need to be relative to each user who logs in.
Now, there are two possible ways to accomplish this (well, three if you want to package deploy but we're talking about Config Profiles so we'll stick with two).
1.) Dock payload in a Configuration Profile: You can go the route of using the Dock payload and it gives you the option to type in the full path of the folder/file that would live on the right side of the dock and it also allows you to choose from a pull down to show APPLE INSTALLED APPLICATIONS ONLY on the right side of the dock... yes, you read that right, currently you cannot add 3rd party apps to the dock with the Dock payload. Bye bye Chrome and Firefox, you will be missed. Ok, so this solution does not work for us.
2.) Use the Custom payload in a Configuration Profile to upload a plist. Basically, set up a dock on a machine the way you want it, copy the com.apple.dock.plist file from the said user library folder, and then upload in the Custom payload section within a Config Profile. This works great until we get into the Documents and Downloads folders. Since they are user specific in the plist, weird question marks and symbols show up in the dock when a different user logs in. However, if there was only a way to make the paths relative in the plist... YOU CAN! See below...
This is a sample of how a typical entry for the Downloads folder would look like in your dock plist:
<dict> <key>GUID</key> <integer>3794117482</integer> <key>tile-data</key> <dict> <key>arrangement</key> <integer>1</integer> <key>book</key> <data> Ym9vaxQDAAAAAAQQMAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAKAIAAAcAAAABAQAATGlicmFy eQAGAAAAAQEAAFN0YWNrcwAAFwAAAAEBAABEZXBhcnRt ZW50IEFwcGxpY2F0aW9ucwAMAAAAAQYAAAQAAAAUAAAA JAAAAAgAAAAEAwAARTQBAAAAAAAIAAAABAMAAJOvAQAA AAAACAAAAAQDAACVrwEAAAAAAAwAAAABBgAAWAAAAGgA AAB4AAAACAAAAAAEAABBvFLUpgAAABgAAAABAgAAAgAA AAAAAAAPAAAAAAAAAAAAAAAAAAAAAAAAAAEFAAAIAAAA AQkAAGZpbGU6Ly8vAwAAAAEBAABPSVQACAAAAAQDAAAA wFrM6AAAAAgAAAAABAAAQbzTzbsAAAAkAAAAAQEAADk5 MzY0MDBCLTZCOUUtM0M4Mi05NUM0LTJBNzE1NTNCMzg4 MRgAAAABAgAAgQAAAAEAAADvEwAAAQAAAAAAAAAAAAAA AQAAAAEBAAAvAAAAuAAAAAECAABhMDIyN2Q1NWY3NGIx M2I1YWY0Y2EyNjA5YzI0MmU3N2UzMGM5ODU0OzAwMDAw MDAwOzAwMDAwMDAwOzAwMDAwMDAwMDAwMDAwMjA7Y29t LmFwcGxlLmFwcC1zYW5kYm94LnJlYWQtd3JpdGU7MDAw MDAwMDE7MDEwMDAwMDI7MDAwMDAwMDAwMDAxYWY5NTsv bGlicmFyeS9zdGFja3MvZGVwYXJ0bWVudCBhcHBsaWNh dGlvbnMAtAAAAP7///8BAAAAAAAAAA4AAAAEEAAARAAA AAAAAAAFEAAAiAAAAAAAAAAQEAAArAAAAAAAAABAEAAA nAAAAAAAAAACIAAAXAEAAAAAAAAFIAAA1AAAAAAAAAAQ IAAA5AAAAAAAAAARIAAAEAEAAAAAAAASIAAA8AAAAAAA AAATIAAAAAEAAAAAAAAgIAAAPAEAAAAAAAAwIAAAzAAA AAAAAAAB0AAAzAAAAAAAAACA8AAAaAEAAAAAAAA= </data> <key>displayas</key> <integer>1</integer> <key>file-data</key> <dict> <key>_CFURLString</key> <string>file://Users/admin/Downloads</string> <key>_CFURLStringType</key> <integer>15</integer> </dict> <key>file-label</key> <string>Downloads</string> <key>file-mod-date</key> <integer>3536342438</integer> <key>file-type</key> <integer>2</integer> <key>parent-mod-date</key> <integer>3536342617</integer> <key>preferreditemsize</key> <integer>-1</integer> <key>showas</key> <integer>2</integer> </dict> <key>tile-type</key> <string>directory-tile</string> </dict>
Notice in the file path above how it's specific to the user "admin". This is not good and will cause problems. Here is how you fix it. Basically change the above to look like this:
<dict> <key>GUID</key> <integer>3794117482</integer> <key>tile-data</key> <dict> <key>arrangement</key> <integer>1</integer> <key>displayas</key> <integer>1</integer> <key>home directory relative</key> <string>~/Downloads</string> <key>showas</key> <integer>0</integer> </dict> <key>tile-type</key> <string>directory-tile</string> </dict>
Wow, that looks much better. You can simply change the folder name in the above to "Documents", "Pictures", whatever. Notice too that the key "home directory relative" is the main workhorse here. This tells the Dock to pull the relative location of ~/Downloads. The other keys such as arrangement, displayas, etc.. are settings you get when you right click on your folder in the dock to make it display as a grid, stack, etc... If you're copying the plist file, you won't need to change these settings and can leave them be.
Yes, this is a bit tedious but at least it's a workaround that allows you to successfully deploy a Configuration Profile that allows you to add Apple Apps AND 3rd party apps as well as have working, aesthetically pleasing folders (no weird question marks or icons) on the right side of the dock.
Hope this is helpful and useful until Jamf finally adds this feature: Add third-part apps to Dock configuration profile
@Tabby1039 Thanks for the link. I tried dock master before creating this post. The profile it creates basically gets stripped down to nothing when uploaded into Jamf Pro. Total bummer. I believe others have also mentioned the same issues with dock master and Jamf Pro config profiles.
Out of curiosity, are you having success with uploading the dock master config profiles to your Jamf Pro?
@dilan I have used the Dock Master profile as a .mobileconfig (albeit in a very limited number of instances) and while it LOOKS stripped down when uploaded it does adjust the dock accordingly when it gets deployed.
Did you try deploying it once you got it uploaded even though it didn't look right?
Thanks. I'm sure this will be helpful to a lot of people. I tried using config profiles to manage the dock, but unfortunately my users began complaining that they couldn't remove the icons etc. I eventually just created a launch agent that runs a script to manage the dock w. dockutil upon first login.
Great post! This worked for me when nothing else would having a user's downloads folder display in the dock without a question mark or red nullify sign in a AD environment. I created a package using the makepackage.command from Dock Master but used the com.apple.dock plist file captured from a fully customized Sierra dock. I brought the makepackage.command created package into Composer and set the Dock Master script to true so it would update the currently logged in user's dock and re-launch it then I made that package available via policy in Self Service so user's or a tech can reset the dock manually under the user's logged in account. I also have a policy applied at recurring check-in to replace the all user user template once per computer. I have one issue with Yosemite clients with a recent OS update. Maps, Photos and iBooks appear to the right of System Preferences with newly created user accounts even when the all user template has been update with the customized com.apple.dock plist. Trying to figure that one out but Sierra does not appear to have this issue.
This is really not an ideal way (from an admin perspective) to administer a dock setup, so much work when you want to change it in anyway.
You're far better off adding https://github.com/kcrawford/dockutil python script to your scripts, then you can call it run a policy using the parameters to point to the app path, folder or file path, specify where in the dock you want the icon to be and more as far as custom options go.
In my experience dockutil by K Crawford has been by far the best.
This was helpful for creating my configuration profile via custom settings. You mentioned using your plist edit to add additional folders to the dock, like documents and only needing to change the folder name. this did work, however, it's showing the icon for Downloads on the Documents short cut. The short cut works and has the proper path in place. What needs changed on the plist to allow the Documents icon to show instead of the Downloads icon?
We have actually been using DockMaster recently (http://techion.com.au/blog/2015/4/28/dock-master). When you download the config profile it will create for you, you can search inside the downloaded file under the "payload" subfolder for the plist. This makes things much easier instead of trying to edit a plist yourself. In DockMaster, I would recommend creating all the dock items as "removable" as opposed to "fixed". We had issues with the fixed version not working as expected. Hope this helps.