I'm trying to use AddDockMCXMyApplicationsFolder using terminal commands however i cannot figure out how to syntax it. Help is much appreciated
do shell script "defaults write com.apple.dock persistent-apps -array '<dict><key>Dock Payload</key><dict><key>MCXDockSpecialFolders</key><array><string>AddDockMCXMyApplicationsFolder</string></array><key>PayloadDescription</key><dict><key>_CFURLString</key><string>AddDockMCXMyApplicationsFolder</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict></dict>'; killall Dock"
This is what I have so far and it does not work im assuming cause of syntax and other issues. Help is appreciated.
You can directly use the defaults
command. I'm using persistent-others
, but you can add it as persistent-apps
. See theDock reference for details.
I'm formatting the input with \
for reliability, and it should work, but you can also inline it.
defaults write com.apple.dock persistent-others -array-add "\
<dict>\
<key>tile-data</key>\
<dict>\
<key>file-data</key>\
<dict>\
<key>_CFURLString</key> <string>file:///Applications/</string>\
<key>_CFURLStringType</key> <integer>15</integer>\
</dict>\
<key>file-type</key> <integer>2</integer>\
<key>showas</key> <integer>1</integer>\
</dict>\
<key>tile-type</key> <string>directory-tile</string>\
</dict>"
You also need to restart the Dock:
killall Dock
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.