Skip to main content
Question

Help needed with: defaults write com.apple.dock


Forum|alt.badge.img+1

Hi, i just beginning with this so please forgive me my ignorance!
Ok, i need some help with this: (in this) i want to add some like Documents to the dock. It's working as long as i use the following:

<dict> <key>_CFURLString</key> <string>/Users/Me/Documents</string> <key>_CFURLStringType</key> <integer>0</integer> </dict>

But it does not works properly when using (the VARIABLE $HOME or using ~):

<dict> <key>_CFURLString</key> <string>$HOME/Documents</string> <key>_CFURLStringType</key> <integer>0</integer> </dict>

Does this mean that you can't use VARIABLES?
(here's the complete "script")

defaults write com.apple.dock persistent-others -array-add ' <dict> <key>tile-data</key> <dict> <key>displayas</key> <integer>1</integer> <key>file-data</key> <dict> <key>_CFURLString</key> <string>$HOME/Documents</string> <key>_CFURLStringType</key> <integer>0</integer> </dict> <key>file-label</key> <string>Documents</string> <key>showas</key> <integer>2</integer> </dict> <key>tile-type</key> <string>directory-tile</string> </dict>'; Killall Dock

4 replies

Forum|alt.badge.img+7
  • Contributor
  • 98 replies
  • May 22, 2017

Have you tried using the $USER variable:
/Users/$USER/Documents


Forum|alt.badge.img+7
  • Contributor
  • 98 replies
  • May 22, 2017

Have you tried using the $USER variable:
/Users/$USER/Documents


Forum|alt.badge.img+7
  • Contributor
  • 38 replies
  • May 23, 2017

I wouldn't use that method to add items to the dock, it is notoriously unreliable, and likely to differ with OS versions.

My best advice would be deploy 'dockutil' in a package and call it with scripts, it works really well and has a lot of settings you can customise.

Download it from:

https://github.com/kcrawford/dockutil


Forum|alt.badge.img+6
  • Contributor
  • 15 replies
  • May 23, 2017

I have set up my dock using profile management.
On a test machine, I created a dock with the Apps and folder that I wanted.
Then I went I copied the plist file /Users/Testaccount/Library/Preferences/com.apple.dock.plist to my machine. On Profile Management, if you wish to create a new profile, you can import the plist in the Custom Settings Payload and simply delete the string: _CFURLString which contains the user name (in my example, it will be "Testaccount")

This is the link that helped me: https://www.jamf.com/jamf-nation/discussions/18357/el-capitan-user-template-dock-customisation-issue

And now, any user can log in to this machine and they will all have the same dock that I have set up.
On the plus side, you don't have to play with SIP.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings