Advertisement

The Burden of File Synchronization

by
Student iconAre you a student? Get a yearly Tuts+ subscription for $45 →

First world problem alert! If you have the luxury of using two computers for your day-to-day coding - for example, a desktop for the office, and a laptop for home - you've likely found yourself complaining (or cursing) when your files aren't syncing correctly.

Why can't my laptop be an exact mirror of my desktop?

I know I have! I've even thought to myself, "Why can't my laptop be an exact mirror of my desktop?" Well, there are ways to accomplish this, but, they're time consuming and aren't as consistent as you might hope. Nonetheless, let's review a few ways that we can sync two computers.


Sync your Home Directory with Dropbox

It's likely that all of us use Dropbox to some extent. The default installation will create a ~/Dropbox directory; however, we can also use "Selective Sync" to define which folders should be watched.

Selective Sync

Now, we could sync our entire home directory, as exemplified in the image above. There are still potential concerns with this method though:

1 - Space ain't free, yo!

The basic free Dropbox plan offers 2GB of space - in other words, not very much. If you intend to sync your entire Home directory, you'll need to commit to either the 50GB or 100GB plans, which will run you $120 or $240 a year, respectively. Yikes! Even worse, if you're like me, you'll find that even 100GB isn't enough.

Dropbox Plans

2 - Endless Syncage

If you do choose to sync your entire home/ directory, you may find that, seemingly at all times, Dropbox is syncing. Download an iTunes movie on your laptop, and, when you turn your desktop computer on, it'll take an hour to download that one large file. This can be incredibly irritating. Also, while, as I understand things, the process of downloading a large file shouldn't interfere with small documents being synced at the same time, I've found that it often does. If I save a Word document on my laptop, sometimes it can be a good wait before it shows up on my other computer.

All of these small irritations quickly add up.

3 - CPU Intensive?

I must admit that this one is a bit odd. I've noticed that, at some points, Dropbox can be a bit hard on my CPU. After checking my computer's Activity Monitor, I've found Dropbox taking up as much as 30% of my CPU, dramatically reducing my computer's performance.

All that said, this seems to be a sporadic effect. As I write this article, while syncing, Dropbox is using less than 1% of my CPU. It's certainly odd. Maybe you guys have some notes in the comments?


Use Synchronization with GoodSync

GoodSync

If you require a cheaper way to sync your files, you might look into GoodSync, which allows you to create any number of jobs (free edition is limited to three). For example, I could create a job which, each day, copies all of the files from a particular directory on my desktop over to my laptop. Alternatively, I could also instruct GoodSync to actively watch my Desktop directory and copy files over in real-time. If you choose this route, note that it can affect your computer's performance a bit.

The obvious advantage to using GoodSync is that you're not paying a monthly fee.

The service even makes the process of locating the various computers in your local network as easy as possible. If you sign into GoodSync on each computer, your file system will automatically be available across all computers.

Up until now, this is the method that I had been using. It certainly works, but, again, there are sporadic hiccups. Most notably, I still have to wait for the necessary files to copy over, and, again, from time to time, the app seems to falter and miss certain triggers.


It's Difficult to Sync Settings

While some apps allow us to sync configuration settings and databases, via Dropbox, others do not. For instance, let's consider an app that allows you to save commonly used snippets (Snippets in my case). You've likely found frustration in the fact that a snippet you save to your laptop's version of Snippets will not be available on your desktop.

Snippets specifically allows you to sync your XML database via MobileMe, but most of us don't use it - so, back to the drawing board.

The Common Solution

On the Mac specifically, the frequently advertised solution is to create a symlink.

So let's do one together; our job is to sync the database for Snippets across our two computers with Dropbox. This database XML file will be stored within ~/Library/Application\ Support/Snippets.

First, cd/ to the Application Support directory, mentioned above.

 cd ~/Library/Application\ Support

Next, we'll copy the Snippets directory over to Dropbox. If you're not syncing your entire home directory, keep things clean and create an Application Support directory in the root of your Dropbox folder.

 mv Snippets ~/Dropbox/Application\ Support

Now, we'll create a symlink. Make sure you're still within the ~/Library/Application\ Support/Snippets directory, and type:

 ln -s ~/Dropbox/Application\ Support/Snippets Snippets

To better understand this line, think of it as: ln -s [path/to/directory/to/sync] [path/to/new/folder].. This code creates a symbolic link, which allows us to store Snippets' database on Dropbox, but still function as expected. The app will want to find these files in the Application Support/ directory, and this method allows for that.

Repeat these steps for each computer, and then test it! Create a new snippet on your laptop, and watch it show up on your desktop, after Dropbox syncs the file.

So sure, this method works; but it's not perfect.

  1. It's time consuming. Will you do this for each app, or symlink your entire Application Support directory?
  2. Not all apps can be synchronized this way. For example, Quicken will kick up a fuss if you use this technique. I've yet to find a way to get Quicken to play nicely across multiple computers. There are countless forum threads on this particular topic. It's easier to use Mint.com, if it's available where you live.

Why Complicate Things?

One day, not more than a week ago, as I found myself, again, wishing that my laptop was a mirror for my desktop, I realized that I was complicating things. Why do I need two separate harddrives? How much time have I wasted researching synchronization tools?

From today on, I am now a "one computer" man. I've sold my iMac and laptop, and have replaced them with a 15 inch Macbook Pro and a Thunderbolt display. When I'm in my office, I connect the laptop to my monitor, work in the glorious 27 inch fashion that I've grown accustomed to. And when, I'm on the couch, or - gasp... in bed working - the laptop is disconnected, and it's business as usual.

No more synchronization, no more complaining, no more hassles. It took me years to choose the most obvious solution.

My Question for You Is...

If you are in a similar position, how do you personally deal with the burden of file synchronizing?