Automatic Sync of CodeBox Library Between Several Macs

So yesterday Apple has released 10.6.6 update with App store for Macs. One of my first purchases was CodeBox from Vadim Shpakovski.

This application is really must have for all developers, but I have few things that I need for it to be perfect for my use.

It lacks sync between more than one Mac and I’m working on 4 different Macs, so I would like to have same code snippets everywhere without importing of every snippet separately, and you cannot export whole lib, only one code snippet at a time.

So I started looking into it to see if I can sync it in some way without too much hassle and work and I have founded way to do it.

I’m big fan of Dropbox so why not use it here.

Here are steps required to have CodeBox synced over more than one Macs:

  • Create one folder in your Dropbox folder, I have name it CodeBox :-)
  • Now quit CodeBox on one Mac (the one with more snippets)
  • Start Terminal and execute following commands
    1. cd “Library/Application Support”
    2. cp com.shpakovski.mac.codebox/* ~/Dropbox/CodeBox (here you will replace amar with your username)
    3. now we will delete folder and create symlink
    4. rm -rf com.shpakovski.mac.codebox
    5. ln -s ~/Dropbox/CodeBox com.shpakovski.mac.codebox
    6. that’s it!!

So now you need to repeat steps above on another mac on which you want to sync CodeBox library to.

If you don’t have Dropbox account create it here. It’s free and you will receive 2GB of disk space.

Note 1: This is only temporary solution, I’m sure that Vadim will implement sync option in future updates.

Note 2: Remember, you need to quit CodeBox on other Macs to be able to sync properly, because CodeBox is reading Library files on startup and it won’t know that you had changed something on mac nr2 so it will save current changes over those which are the latest ones.

Note 3: This solution works for Snippets application as well, the only thing that differs is application folder in Application Support.

Note 4: I have corrected command for creating of a symbolic link and edited rest of the commands. I don’t know how did I get L there. Thank you Dalton for pointing that out.