Warning! This “symlink” technique is not compatible with macOS Sierra iCloud Sync, part of the “Optimize Storage” feature. It will result in data loss! Either turn off iCloud Sync or revert to the standard Dropbox folder locations!
I love my 27″ iMac, but it’s a little tough to take it on the road. So I like to keep my Documents folder in sync between it and my MacBook pro. I’ve recently switched to a new method that uses cloud storage service, Dropbox, and am thrilled with the result. Read on for my document synchronization formula!
You might also want to read How Google and Dropbox Revolutionized My Laptop Migration
The Challenge of Synchronization
Keeping multiple machines “in sync” has always been a challenge. Ever since struggling with LapLink way back in the 1990’s, I’ve been looking for a better way.
Once I moved to Mac OS X, with its UNIX underpinnings, I began using rsync to move data back and forth. But rsync needs to be pointed in the right direction: It’s great for making sure the latest version of “this” is “over there” but not much help when trying to determine which is newer.
Early last year, I switched to the excellent open-source application, Unison. Like rsync, Unison optimizes the movement of data between multiple machines. But it detects which data is newer on a file-by-file basis and prompts before acting.
But Unison only runs on demand and requires interaction and attention. I also didn’t feel comfortable exposing it to the Internet, so both computers had to be on the same LAN.
Introducing Dropbox
I never expected Dropbox to be part of my dream synchronization solution, but that’s what it’s become. Dropbox mirrors local data to the cloud, allowing files to be made available through a web browser or mobile app. It can share a folder between multiple computers, and even multiple users.
But data in Dropbox “lives” in Dropbox. Drag a file into your Dropbox folder and it now “lives” in the Dropbox cache and cloud. If the cache exists on the same drive as the original location, the file will be moved; it it is on another disk, a copy will be made. Either way, the original location is no longer relevant: Only the copy in the Dropbox folder will be synchronized.
Symlink to Sync
But I didn’t want to live out of the cache folder. I wanted my data to remain in my Documents folder. It’s not obvious how to do this with Dropbox, but a few FAQs and tools exist to make it happen.
The Dropbox application will follow symbolic links in the cache to discover data to synchronize, and this is the secret. Simply create a symbolic link (“symlink” for short) to another folder and you can leave your data wherever you want to!
There are two essential tricks to make this happen:
- The folder symlinks in the Dropbox cache folder must have the same name
- Dropbox must be turned off on all but one computer when initially setting all this up
A great little app called MacDropAny even exists to facilitate this process, and it’s not too difficult if you follow these rules.
Warning! Do not try this in macOS Sierra with iCloud Sync! Data loss will result!
Step By Step Instructions
Make sure you follow these instructions to the letter. Failure to turn off Dropbox, for example, can result in data loss! Good thing Dropbox keeps old copies available for recovery!
These instructions assume you have two Apple Macintosh computers, named “Computer 1” and “Computer 2”, and that the Dropbox client and MacDropAny application are installed on both. A similar method will presumably work with Windows computers, but that’s left as an exercise for the reader!
Note: You must start with exactly-identical folders on both computers. The easiest way to ensure this is illustrated below, but there are other methods (rsync, for example).
- In Finder on Computer 1, drag a folder from any location and drop it on the MacDropAny application in the Applications folder. For example, I dropped the folder, “~/Documents/Example”.
- MacDropAny will ask where to create the link. Select a location in your Dropbox cache. For example, I created a folder called “~/Dropbox/Documents” and selected that.
- MacDropAny will ask what to name this symlink. It is critical that this name be the same on both sides, and I suggest using the default name, that of the source folder. In my example, I called my symlink “Example” so the full path is “~/Dropbox/Documents/Example”.
- Dropbox will discover, index, and synchronize this folder on both computers. You must wait until this process is finished before proceeding to the next step!
- Did you wait until it’s finished? Really? Did you check both computers? Click the Dropbox icon on both, just to be sure it’s not still synchronizing.
- Quit Dropbox on Computer 2. This is very important. You can leave it running on Computer 1, but it must not be running when you perform the next step!
- On Computer 2, open the Dropbox cache folder. Note that the symlink will show up as a real folder full of files here. Drag-and-drop this folder to the desired location. In my example, I dragged the folder “Example” from “~/Dropbox/Documents” to “~/Documents”.
- Still on Computer 2, drag this new folder and drop it on MacDropAny.
- Select the same folder in the Dropbox cache and give it the same name. This is absolutely critical. In my example, the symlink went back in “~/Dropbox/Documents” and was called “~/Dropbox/Documents/Example”.
- Check to make sure both computers have identically-named symlinks in the exact same location in both Dropbox cache folders.
- If you’re really sure, start the Dropbox application on Computer 2 and let it discover, re-index, and sync the folder. The synchronization should be very quick since no data has to be moved.
That’s it! Now when you edit a file in “~/Documents/Example” on one computer, it will automatically and nearly-instantly show up on the other computer, as long as both are connected to the Internet. And if you do it offline, these changes will queue until you reconnect. You’ll also have access to these files online and through the mobile Dropbox app. Nice!
Caution!
This really isn’t difficult, but make sure you don’t take any shortcuts. Dropbox will automatically delete the whole folder if you forget to turn it off while creating the symlink on the second computer, and it will delete any missing files if you try to use an incomplete copy. Monitor the “Events” tab in your Dropbox web page to make sure you didn’t lose any data, and restore any accidentally-deleted files from there as well.
This makes it well-suited for keeping multiple “Documents” folders in sync, but isn’t always desirable. Some applications (notably iPhoto) don’t want to sync individual files, they want an entire bundle of files to be consistent. So this isn’t a perfect Mac-syncing solution. It does work for individual files usually found in the Documents folder, but be cautious. Don’t open the same file on two machines simultaneously, for one thing.
Umberto says
As a (former) Dropbox user I’d like to recommend SugarSync as an alternative way to backup and sync your data in the cloud. Free accounts provide 5GB of disk space and you can choose which folders to sync in your hard drive, not only one single dropbox.
If anyone wants to register for an account, feel free to use my referral link that will add 500 MB further bonus to both mine and your account 🙂
https://www.sugarsync.com/referral?rf=do5qm2rpjareh
Thanks!
sfoskett says
Some of my friends use SugarSync and tell me it’s great. I’ll have to give it a try!
Moneillmichelle2 says
Thanks for the instructions but I’m stuck. I’ve got everything up to step 7.
But on computer 2 (my laptop) I can’t find the cache file. Any suggestions?
I’ve used finder to locate the file and nothing is found?
is the cache file called “dropbox.db”?
Any help would be appreciated.
Regards.
MO
stevesunderland says
if I set up symlinks on “Computer 1” only and then clone it, will the clone sync automatically?
Soopmail says
Excellent. Just what I needed. Thanks for the tip.
Michael says
I am really confused by step 7. you say to “On Computer 2, open the Dropbox cache folder” but then say nothing else about that folder, why do you need to open this folder?
Matt Brasier says
help! I am missing some files now and I want to switch off the syncing so I can get back in order.. Please help!!
Ami says
So as to modify the symlink without Dropbox synchronizing it back, or something like that.
SteveCodes says
This tutorial is a bit difficult to follow. It’s not hard to do. 1) computer1: drag a folder to macdropany, accept the default name. 2) let it sync. 3) go to computer2, drag the synced folder somewhere on your hd. 4) shut down dropbox. 5) delete the folder in the dropbox folder location on computer2. 6) drag the folder you copied in step 3 on to macdropany. 7) accept the default names (should be identical to what you did in step 1 except you are on computer2. 8) start dropbox and let it sync. 9) test by accessing the folder outside of the dropbox instance of it, that is, wherever you dragged the folder to in step 3. Check it on computer1 in the folder outside the dropbox location. If this helped show your gratitude: http://db.tt/AVFmY23
Mitja Predikaka says
Is it possible to do something like this to synchronize Mac and PC?
So that i would sync my “Documents” folder on Mac with the same folder placed somewhere on PC (just not in dropbox folder)