Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I found this article but it handles the GUI solution.

I would like to automate the setup of a new machine, and do that I've created Dropbox shares of a number of my common configurations. (I could use a github repo, too) Other sites have discussed automating pref configs.

I'd like a bash / terminal command to create an alias in the dock. I presume that the dock is a folder of aliases located somewhere in ~/Library but I can't find it.

Is there any AppleScript solution?

edit: it seems that there is a file, ~/Library/Preferences/com.apple.dock.plist that contains the references.

A Japanese engineer discusses an way to do this C. 2009 (which no longer works).
Another script was designed to add folders to the 'others' area of the Dock – which is alos dated. The latter, however, along with the new format for the Dock plist, and some dict manipulation tips, gives more clues to creating a modern script.

share|improve this question
Is it an application alias you are trying to create or an alias to a file? Once you give me more info I will be able to refine my answer for you. –  Deesbek Oct 14 '13 at 20:52
I want to add an alias to a folder. Counts as a file? –  New Alexandria Oct 14 '13 at 21:12
Oki, I've given you the first command down below to modify the array for the file. All you need to do is add the link you want manually. Then check what has been changed in the dock.plist. Add the change to your script, use the same format with PlistBuddy I specify below. –  Deesbek Oct 14 '13 at 21:19

1 Answer 1

Definitely scriptable with terminal commands.

/usr/libexec/PlistBuddy -c "Print" ~/Library/Preferences/com.apple.dock.plist

Shows you the actual configuration for the dock.

Within the above file you need to modify the "persistent-others" array if you want to create a "file" alias.

This is done the following way:

/usr/libexec/PlistBuddy -c "add:persistent-others:0 dict" ~/Library/Preferences/com.apple.dock.plist

If you want an application alias you will need to modify the "persistent-apps" array.

Once you make the changes and you are testing you need to do:

killall dock

to refresh the dock.

share|improve this answer
I can't make changes of less than 6 characters, so: you need to type killall Dock with a capital D. –  pyb Aug 28 at 13:16

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.