Skip to content

Instantly share code, notes, and snippets.

@sthorne
Last active February 19, 2017 19:38
Show Gist options
  • Save sthorne/e4316e7946fda366a802758582bd4e7c to your computer and use it in GitHub Desktop.
Save sthorne/e4316e7946fda366a802758582bd4e7c to your computer and use it in GitHub Desktop.
Mac OS X launchd plist to sync directory when files added/edited
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>dev-sync</string>
<key>ProgramArguments</key>
<array>
<string>/usr/bin/rsync</string>
<string>-aq</string>
<string>--timeout</string>
<string>5</string>
<string>-e</string>
<string>ssh -i /Users/me/.ssh/id_rsa</string>
<string>/Users/me/workspace/</string>
<string>192.168.0.47:/home/me/workspace/</string>
</array>
<key>WatchPaths</key>
<array>
<string>/Users/me/workspace/</string>
</array>
</dict>
</plist>
launchctl load ~/Library/LaunchAgents/dev-sync.plist
launchctl unload ~/Library/LaunchAgents/dev-sync.plist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment