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.
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.
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!
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.