Ok a lot of people have been asking for this. So for all two of you, here’s how to get your multiple Mac machine’s synced up without having to resort to a paid service (e.g. MobileMe) 😉 This is where everything is going… you mark my words.
Now for the obligatory introduction:
As you all know, computers have become more and more integrated into our everyday lives. And apart from the OS, there are some applications that we rely on almost all the time. Mail, Calendars, Addressbooks, etc. And these are constantly updated. And in the era of portable computing, keeping these devices “synchronized” is an important, but difficult task.
I’m here to give you some suggestions on how to deal with such data – because on OS X you can have near-realtime, reliable synchronization for free.The trick to all this, and the underlying goal is to have all machines access one common data point. Either in the cloud or in the network. I use both depending on the application. And I will list them down as I go along.
Symbolic links
Time to get acquainted with an age-old UNIX construct: the symbolic link. A symbolic link, otherwise known as a symlink, for all intents and purposes, is a “pointer.” But its nature is different from your typical shortcuts (or aliases) in the sense that the latter are only recognized in a certain environment (e.g. Explorer or Finder). Symbolic links are more bad-ass because any application that “sees” a symbolic link sees it as the file/folder it represents.
You can create symbolic links the oldschool way via the Terminal. But if you’re not gangster enough, then you can google for applications that can make them for you.
It’s hard to explain this way so I’ll explain in as I go along with the first example: synchronizing iTunes from a central repository.
Case Study: iTunes
GOAL
I want my two machines to access the same iTunes catalog/databse.
PROBLEM
You think its just a matter of setting your Music library in iTunes prefs? Think again! iTunes preferenes can only set the volume where to store the music files… but where do you think the actual “database” that indexes those files is located? That’s right sucka; ~/Music/iTunes
COMPLICATIONS
Assuming you do have your library set on an external volume, have you ever accidentally launched iTunes without it? It doesn’t throw an error – it just starts using the default directory ~/Music/iTunes/iTunes Music. The result is you now got files spread across both locations. We can’t have that now can we?
And assuming you do remember to plug it in all the time. I said earlier on that the index file is locally stored. So if you have two computers that access the same music folder, but have separate index files… time to call Houston.
SOLUTION
It may seem conter-intuititve, but trust me… LEAVE the music folder settings to their defaults. Just let iTunes access your library like it was ran for the first time – that is to say, set your music folder back to ~/Music/iTunes/iTunes Music
What you should do instead, is to just move the whole ~/Music/iTunes folder and all its contents to your external/network drive, then create a similarly named symbolic link in it’s place in the ~/Music folder.
That’s it! And you didn’t have to configure anything! You can do a clean reformat and just do the same symlink method and it will work each time.
It has an added benefit of not letting iTunes open at all if the external volume is not plugged in. The reason for this is because you when you open iTunes without your external volume, it detects that the volume isn’t there (plus the local database file isn’t there as well) so it will try to default to ~/Music/iTunes… oh, but wait, it’s already there! So it then looks inside… being a symbolic link, it won’t see anything because it’s pointing to an unmounted volume. So iTunes will throw an error – which honestly, I prefer over iTunes opening and doing some stupid shit when I clearly don’t want it doing anything unless my music volume is mounted.
Again, this would not be possible with normal Aliases.
Dropbox
Now here’s an app that when leveraged with the smart use of symlinks is quite a killer combo.
Dropbox is basically a synchornizing app which uses the cloud as a repository, and a local application/daemon that updates that “cloud account” in realtime. You are given 2GB free of charge – anything more, you’ll need to pay. Upon first launch, it will create a “Dropbox” folder – in which everything contained there is constantly monitored. Any changes in any file/folder in that Dropbox folder, is immediately synchronized with the cloud account.
If you have multiple machines with Dropbox installed (and connected to the same cloud account), it will make sure that all contents on those Dropbox folders are synchronized as long as the computers are online. If you change a file in one computer, you can literally look at the second computer’s status and see Dropbox announcing the change – and triggering a file sync/download on the other computer without your intervention.
Sufficed to say though, given how this works (realtime syncing over the web and all) it’s ideal for small files. This is why I didn’t put my iTunes folder to it (besides, my music would never fit anyways).
One of the first things I did was to use Dropbox to synchronize preference files.
Library and Application Support
Most Cocoa applications store their metadata in ~/Library/Application Support And some in ~/Library. Whatever the case, they usually aren’t large files – so they’re perfect candidates for the killer Dropbox-symlink combo method. I’ll give an example of one application and you can just apply the same logic to those that might be applicable.
Case Study: Adium
What better example than an application that has its data (logs/etc.) constantly changed/written on to… you know the drill. We want to sync Adium’s data across machines such that regardless which mahine you run Adium on, they’ll be working with the same data.
Sure, you could definitely do the iTunes thing exactly, but aren’t we forgetting something? iTunes was on a network at home. Adium is one of those things you should be able to use anywhere. And that’s where Dropbox comes in…
So just like with iTunes, we move the ~/Library/Applications Support/Adium 2.0 folder to Dropbox. You’ll see it now syncing with the server (and if you have Dropbox installed on another machine, you should also see it beginning to populate a copy of the Adium 2.0 folder as well.
When everything’s done, create a symlink in ~/Library/Applications Support named “Adium 2.0” which points to the real Adium 2.0 folder which is now located in Dropbox.
Again, that’s all there is to it! You’re good to go!
What’s even more fun is if you do the same to the other computer (just create a symlink (and delete the existing “Adium 2.0” folder in ~/Library/Appliaction Support. There’s no need to copy anything to Dropbox because it should already have synchornized the files into the other machine from the first machine you did all this voodoo with.
Then do the follwing to test if everything’s working.
- Open Adium
- Start chatting
- Take note of the logs and stuff you say.
- Close Adium
- Check if (and when) the Dropbox icon is “idle” (meaning it’s done synchronizing)
- Go to the other machine
- Open Adium
- Verify if the last messages you received/sent on the first machine are there as well.
- Rejoice.
Congratulations, you can now apply this same method to other applications like iCal, AddressBook, any IM client, Keychains, Widgets, etc.
Case Study: Mail
So we now have two methods at our disposal. One is the local network solution I use with iTunes, another is the Dropbox method which I use with a whole bunch of other apps.
Mail, I guess could be done the same way if you really tried, but like I said, given the nature of Dropbox, I don’t think you want to be syncing your mailboxes and attachments on there. We also can’t do the iTunes method because you’d really want Mail to be accessible all the time.
For this, I suggest a different approach: IMAP.
You can google or wiki the definition and details of IMAP, but sufficed to say by nature IMAP operates on the concept of synchronization. When you use IMAP, you’re using a local client, but it constantly synchronizes with the server to make sure what you’re seeing in your end is what the server has. Any changes you make is sent to the server immediately. And any other client connected to it will see those changes reflected.
The beauty of IMAP is that it handles concurrent connections well; meaning you can have Mail applications open on multiple machines and it will handle/resolve conflict gracefully. For example, you delete a message from one computer. It immediately sends that instruction to the server and is executed.
Case Study: Firefox
Firefox is a unique beast in the sense that you could do the Dropbox method for as long as you don’t have concurrent sessions running on multiple machines. Remember that while Dropbox synchronizes stuff in realtime, the applications themselves aren’t equipped to “update” themselves if they see the files they reference have been changed. Meaning that if you’re switching computers, it’s better to make sure the application has been closed on the other side before you launch it on the new computer.
That I can’t rely on Dropbox for my particular Firefox use is quite a disappointment because I would like to Synchronize my add-ons/extensions apart from my bookmarks. Alas, we can’t have it all. Therefore I have to be content in the meantime with synchronizing bookmarks via the Foxmarks add-on.
Conclusion
It’s worth mentioning that the benefit of Dropbox, IMAP, or Foxmarks against a normal local-network synch is that you will still be able to use the applications and go about your business even if you’re not connected, or if you are, but aren’t at home.
If you’re not online, whatever changes or pending syncs will be delayed – and will be executed it as soon as you are.
So there you have it. Reliable, FREE sync options at your disposal. All you have to do is decide what approach is best for which application and you should be good to go.

