Syncing Mac OS X Folders and Sub Folders

In today’s post, tech writer TJ Luoma shares how he uses Sync to set up the folder structure on his Mac, keeping things like his ~/Library/LaunchAgents/ and ~/Library/QuickLook/ folders synced.

From TJ:

My last article for TUAW was BitTorrent Sync gives you the flexibility to sync anything, which included a farewell Easter egg. However, I didn’t have the time to explain a lot of what I use BitTorrent Sync for, which is what I want to do now.

The first thing I did was setup syncing for the standard OS X folders:

  • Desktop
  • Documents
  • Downloads
  • Pictures
  • Movies
  • Music

If you’re a Mac geek of a particular type, you are probably wondering if you can sync your ~/Library/Preferences/ and~/Library/Application Support/ folders. I definitely would not recommend that, as I think it is just begging for trouble later on. However, there are a few sub-folders in there that you might want to sync.

~/Library/LaunchAgents/ – I sync my LaunchAgents folder, but I use the .sync/IgnoreList feature to not sync any file that begins with com. That actually prevents most from syncing automatically, but the ones that I make and do want to sync I prefix with so I’ll know those will sync to all of my Macs (I hinted about that in Keep Desktop Clean By Name).

~/Library/QuickLook/ – This keeps my QuickLook .qlgenerator files sync’d together, and I have a sync’d LaunchAgentplist which watches ~/Library/QuickLook/ and runs /usr/bin/qlmanage -r whenever it changes.

~/Library/Application Support/Screen Sharing/ – I sync this to keep my Screen Sharing .vncloc files in sync across my Macs.

/Library/Caches/Homebrew/ – I use Homebrew on all of my Macs and tend to install the same packages everywhere, so I sync the cache folder so I don’t have to re-download the packages for each Mac.

~/.ssh/ – This one will be controversial to some people who worry about security and who are right now terrified at the idea of someone managing to get into my ~/.ssh/ and muck about with it. But the reality is that my life is boring and no one is likely to ever try to do that, and it’s convenient to have my known_hostsconfig, and authorized_keys sync’d. I added id_rsa*to the ~/.ssh/.sync/Ignorelist so my private key doesn’t actually sync.

Folders Which Do Not Sync Well

I tried syncing ~/Library/Safari/Extensions/ to keep my Safari extensions in sync, but Safari does not like that, and seemingly refuses to recognize new extensions which are added directly to that folder. (This is probably a security feature, in that it prevents some malicious installer from putting something in there which will take over your default searches, or something like that.)

I also tried to sync /usr/local/ because I generally install the same Homebrew things on each computer. That did not work well either, and I recommend avoiding it.

If you use a database app like DEVONthink I would make sure that its database is not stored in ~/Documents/ because I am not sure that it would handle syncing well.

Likewise, I would not recommend keeping your iPhoto library in ~/Pictures/ if you are going to sync it. Ditto for iTunes in ~/Music/. I moved my iTunes files to ~/iTunes/ ages ago because it didn’t make sense to keep it in ~/Music/ when it also includes TV and Movies.

Syncing to Dropbox

I keep Dropbox running on my MacMiniColo machine, and I sync my BTS folders to that machine too, which means that I do not have to worry about my BTS folders not being available for some reason.

I use and love SendToDropbox which is a great way to email files to your Dropbox account. SendToDropbox saves those files to ~/Dropbox/Apps/Attachments/ so I sync that folder (using BTS) to my other Macs. I never really liked the name “Attachments” but using BTS I can name the folder whatever I like, so I call it ~/SendToDropbox/.

Other Folders

All of my Macs share a ~/BitTorrent Sync/Torrents/ folder so I can save a .torrent file to it. On my MacMiniColo machine that folder is actually ~/Dropbox/Torrents/ and I have a Hazel rule on that Mac mini which launchesTransmission whenever a new .torrent file is added to that folder. Transmission looks in that folder and automatically starts sharing the torrent.

This website is run on Statamic which uses plain text files for its configuration and posts. I sync that folder to my Macs so I can write/edit to my website from any of my Macs.

I have a nice short domain name which is conducive to making short URLs, and I wanted an easy way to add those. I wrote a shell script called which lets me automatically add those entries to my site’s .htaccess file and syncs it to my website. The short URL for that script is, naturally.

(The short URL for this article is

Automatically start (or restart) BitTorrent Sync

Because BitTorrent sync is a crucial piece of my setup, I have created a launchd plist which will not only launch BTS when my computer starts up, but will also automatically restart it if it crashes. [1]

BitTorrent Sync TJ Luoma

To install, first launch BitTorrent, go to preferences, and be sure to turn off the option to have the app start at login. (That will be handled by launchd now instead.)

Quit BitTorrent before proceeding.

Once BitTorrent is no longer running, enter these commands in Terminal:

    mkdir -p ~/Library/LaunchAgents/

    cd ~/Library/LaunchAgents/

    curl -sfLO

    launchctl load

None of those lines will give you any feedback, but when you enter the last one, you should notice BitTorrent Sync launch.


I hope this helps give you an idea of the ways that you can use BitTorrent Sync to keep any folder on your Mac in sync with other Macs.

[1] This launchd technique will work for any app that you want to automatically restart after a crash. Just replace<string>BitTorrent Sync</string> with <string>foo</string> where foo is the name of the app that you want to keep running if it crashes. I also have a similar one for Dropbox on my MacMiniColo machine.