macOS Sierra – How to Create Dock Entries via Terminal

dockmacos

So I found a command that lets me create Dock entries via Terminal. This was working fine on OS X El Capitan, but not with macOS Sierra.

Any ideas how this can be done with macOS Sierra?

This is sample command that works with OS X El Capitan:

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/VLC.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>"

Best Answer

As a test in macOS Sierra, I just downloaded the vlc-2.2.4.dmg file and installed VLC to /Applications via drag and drop to the Applications alias within the installer window.

In Terminal, I ran the following command:

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/VLC.app</string><key>_CFURLStringType</key><integer>0</integer></dict></dict></dict>"; killall Dock

Note that I added ; killall Dock directly after the command line from your question.

As the Dock reappeared, the VLC Dock Tile was present and I then click it. VLC opened as expected.