Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Add a folder to the Dock as a file alias in order to make it open directly in Finder
url="file:///Users/jan/Downloads/"
label=$(basename "$url")
defaults write com.apple.dock persistent-others -array-add "
<dict>
<key>tile-data</key>
<dict>
<key>file-data</key>
<dict>
<key>_CFURLString</key>
<string>${url}</string>
<key>_CFURLStringType</key>
<integer>15</integer>
</dict>
<key>file-label</key>
<string>${label}</string>
</dict>
<key>tile-type</key>
<string>file-tile</string>
</dict>
"
killall Dock
@fnajm

This comment has been minimized.

Copy link

@fnajm fnajm commented Feb 29, 2020

Thanks for this. I'm curious, does it create a permanent change on my Mac and is that change reversible? How do I reverse it?

@jan4843

This comment has been minimized.

Copy link
Owner Author

@jan4843 jan4843 commented Feb 29, 2020

The command has the same effect as adding an item manually to the Dock. Dragging the item out of the Dock with the mouse will also remove the entry from the plist.

@fnajm

This comment has been minimized.

Copy link

@fnajm fnajm commented Feb 29, 2020

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.