Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
This is the launchd.plist file that keeps my Dropbox and Google Drive folders synchronized.
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "">
<plist version="1.0">
<string>/usr/local/bin/unison \
-times \
-prefer=newer \
-owner \
-group \
-ignorelocks \
-terse \
-batch \
-ignore='Path .dropbox.cache' \
-ignore='Path .DS_Store' \
-ignore='Path Icon?' \
~/Google\ Drive/ \
<string>~/Google Drive</string>

p120ph37 commented Jul 22, 2015

You need the unison command-line tool installed first - get it via home-brew (brew install unison). Then copy this file to ~/Library/LaunchAgents/ (it should be owned by your user, not root, and permissions should be 644) and run launchctl load -w ~/Library/LaunchAgents/gdrive-dropbox-sync.plist (without sudo) to start it up. It will monitor ~/Google Drive and ~/Dropbox for changes and propagate them. Logs will appear in ~/unison.log


p120ph37 commented Jul 23, 2015

As of OS X Yosemite (v10.10), the EnableGlobbing key is no longer supported. This means that the ~/Google Drive/ and ~/Dropbox arguments to unison will not be expanded to the user home directory (though the arguments to WatchPaths still seem to handle ~ correctly...)

Consequently, I have updated the plist to run unison via /bin/sh so as to allow home-directory expansion.

It should now once again function under the latest OSX version.

Thank you! Saved me alot of confusion getting sync to work with unison. Exactly what I was looking for.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment