Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding applications to dock through terminal

Tags:

terminal

macos

I'm managing multiple computers and want to send out a script that will run in terminal that will add certain applications to the dock. The code I am trying is

defaults write com.apple.dock persistent-apps -array-add '<dict><key>tile-data</key><dict>    <key>file-data</key><dict><key>_CFURLString</key><string>/Macintosh HD/Applications/Google Chrome.app/</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>'
killall Dock;

I have also tried

defaults write com.apple.dock persistent-apps -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Google Chrome.app/</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>'
killall Dock;

with and without spaces in between Google Chrome. Thanks for any help in advance.

like image 910
user3088745 Avatar asked Dec 26 '22 10:12

user3088745


1 Answers

I'm running Mavericks and this worked for me:

defaults write com.apple.dock persistent-apps -array-add '<dict><key>tile-data</key><dict><key>file-data</key><dict><key>_CFURLString</key><string>/Applications/Google Chrome.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>'

killall Dock
like image 120
Mateusz Szlosek Avatar answered Jan 05 '23 16:01

Mateusz Szlosek