Skip to content

Instantly share code, notes, and snippets.

@searls
Last active August 29, 2015 13:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save searls/8771763 to your computer and use it in GitHub Desktop.
Save searls/8771763 to your computer and use it in GitHub Desktop.

Not syncing two macs

I've decided to experiment with maintaining two Macs for development (a clean, unblemished one to luxuriate over at home, and one to eventually run into the ground during my travels). The last time I did this was 2006. It was a fantastically frustrating experience and I gave up. I expect a similar outcome this time.

Here's the game plan:

  • Backup the original Mac to Time Machine
  • Wipe both new target Macs with a fresh OS X install, restore both from the same Time Machine backup (effectively "forking") the first computer's system image.
  • Have one Mac inherit the first's Time Machine backup and adopt its online Crashplan backup.
  • Start fresh backups for the other Mac. This required carefully deleting the /Library/Application Support/CrashPlan/.identity from the second Mac before ever allowing CrashPlan to launch (otherwise it'll log out the first Mac, start backing up, and confuse the hell out of CrashPlan)
  • Create an encrypted sparsebundle for my personal documents and leave it in Dropbox so both machines can easily open and add/edit documents to it. [Warning: it's super easy for an individual band of a sparsebundle to come into conflict when you do this; I've never knowingly lost data when bands did come into conflict, but I also only open the sparsebundle once every couple weeks and usually just to drop a new tax file in.]
  • Adopt a "backup" approach to syncing my code directories between the two computers. Rather than try to sync the two code directories (themselves full of about 200 git repos each) and risk corrupting my git databases), I'm using Dropbox to sync two copies of the code directory separately. That way I'll always have both machine's code directories at hand should I need something that I forgot to push to a real Git remote.

UPDATE Well that experiment lasted all of fifteen minutes. A single npm install command caused Dropbox to peg 100% of the CPU for thirty minutes. Whelp.

I thought about screwing with file permissions to make sure I didn't make any changes to the Dropbox-embedded code directory of the wrong machine, but figured that would only mess up Dropbox. Instead, I decided to reach for my old friend in security: obscurity.

I created this directory structure I'll only ever look at when I'm hunting for something I lost:

Dropbox/
└── dev
    ├── mac1
    │   ├── .profile
    │   ├── bin
    │   └── code
    └── mac2
        ├── .profile
        ├── bin
        └── code

And then from each Mac, made symlinks back to my home folder for .profile, bin, and code to the appropriate Dropbox-backed directory. This seems about as safe as I'm going to be able to make it without having to take some concrete action every time I want to backup my code in a passive way (with a low-friction way of retrieving and searching on it).

Other ideas

I didn't investigate it too much but I liked @ifandelse's idea of a git commit hook to kick off a transfer. I've thought of a bunch of ideas following this thread, but I don't have the time to work on it right now.

I'll be sure to come back and updte this gist with the horror story that results after Dropbox inevitably corrupts my git repositories even when only one computer is ever editing them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment