I have three machines running os X:
- My Macbook Pro for travelin' to them clients; it lives wherever I am.
- My iMac for writing code on a big screen; it lives on my desk
- My Mini for watching movies, listening to music, serving web pages, serving mail, serving my calendars; it lives in my Middle Atlantic rack (highly recommended rack manufacturer, by the way. Nice stuff.)
Synchronizing my data (especially my home directly) has recently become much more important to me. I've been spending rather more time physically at clients and can't afford the "I think I edited that on the desktop machine, which is turned off at home" problem. For code, this is handled quite nicely by subversion, but I also need a simple way to synchronize my home directories between my laptop and my desktop. (I don't so much care about the contents of my home directory in my server because I don't really produce content there). My friend Noah Gift
, who really is a gift to my world would tell you to use nfs
and apple's offline synchronization to do this for you. This is fancy and fine voodoo, and something I used to do way back when I used Linux primarily (gasp) but I didn't really want to serve my home directory from a central location. Version controlled home
is also overkill for me and dealing with conflicting files in svn can be a bit of a pain (yes, Hal, I thought about your suggestion as well). I really want my laptop to act kind of like my iPhone. I want to come home, plug in, deal with a few conflicts if and only if I care at that point, and sync without having to also think.
What is need is a simple directory synchronizer. Ok. Shouldn't be hard to find, right? Wrong. Every (payware, even) GUI file synchronizer I've tried has ended in the spinning beachball of death. Grumble Grumble. Ok again. Time to slide off into command-line utilities. I thought maybe I would use git instead of svn, but I don't want to use git (yet). I'm resistant to use anything designed for version control for this purpose and I'm too lazy to learn yet another one, even though git is supposed to be very fast at resolving differences between trees. Maybe later. Sorry Linus
Enter a little-known synchronizing tool called Unison
. I Love this software.
From the Unison site:
- Unison runs on both Windows and many flavors of Unix (Solaris, Linux,
OS X, etc.) systems. Moreover, Unison works across platforms,
allowing you to synchronize a Windows laptop with a Unix server, for
- Unlike simple mirroring or backup utilities, Unison can deal with
updates to both replicas of a distributed directory structure.
Updates that do not conflict are propagated automatically. Conflicting
updates are detected and displayed.
- Unlike a distributed filesystem, Unison is a user-level program: there
is no need to modify the kernel or to have superuser privileges on either
- Unison works between any pair of machines connected to the internet,
communicating over either a direct socket link or tunneling over an
encrypted ssh connection. It is careful
with network bandwidth, and runs well over slow links such as PPP connections.
Transfers of small updates to large files are optimized using a compression
protocol similar to rsync.
- Unison is resilient to failure. It is careful to leave the replicas
and its own private structures in a sensible state at all times, even
in case of abnormal termination or communication failures.
- Unison has a clear and precise specification.
- Unison is free; full source code is available under the GNU Public
In other words, exactly what I need. :) Good instructions for setting it up for this purpose are available on the Linux Journal
site. It's easy to keep it from synchronizing certain directories (I leave ~/Library and ~/svnCheckouts alone, for example) and it's easy to keep it from synchronizing certain file types as well (.DS_Store, .Spotlight*, .Trashes, etc.). If I reorganize my entire home folder on the train, that reorganization is mirrored on the desktop. No muss. No fuss. No "svn move."
So! When I come home, I shutdown my laptop (it's usually sleeping in my bag), restart holding the T key, which turns it into a very expensive external drive, connect a firewire 800 cable between it and my desktop and synchronize. Happy me.