How Unison Changed My Life and Made Me a Better Remote Worker

A while ago, I shared some bash scripts that I’d written to sync my local MacOS machine to my FreeBSD dev environment. Earlier, I’d written about mounting a NFS share on a Mac.

I will be using pushchanges and pushall no more! I found Unison, and my troubles are lifted. Unison is a great little app that hooks up a local folder with a remote folder via SSH. Since it runs on both machines as a user-level application, there’s no need for changing kernels and no lag from trying to scan a remote filesystem. However, you get the same effect that you’d have from an NFS or SSHFS mount. Changes take about a second to propagate between the two systems, but that’s pretty forgivable, since it happens in the background and only uses the network bandwidth that it actually needs to.

I did run into a few caveats with it:

  1. You have to install it on both machines, and it has to be the same version on both machines. Since my yahoo BSD machine could only find version 1.16, that was what I had to install on the mac.
  2. Read the command-line options, and use them. The UI is pretty nice, but without the -repeat option, it’s pretty much useless.
  3. Older versions are a bit flaky, especially when it comes to symbolic links. Make sure that you carefully set the -ignore flags to avoid any symlinks in your sync folders. (Frequent use of gmake-symlink is a big culprit.)
  4. If it dies on an error, it might corrupt the archive. Delete the archive on both machines, and try again. (Archive files are in ~/.unison/ and start with “ar”.)
  5. The mac puts its unison stuff in ~/Library/Application Support/Unison/. Do ln -s "~/Library/Application Support/Unison" ~/.unison and you’ll save yourself a lot of remembering.
  6. Sometimes, it’ll hit some file that makes it barf. I don’t know why. In my case, it was “Rate.php”. I just deleted the offending folders on both machines, and it ran fine. Then, while it was running in -repeat mode, I checked out the folders, on one machine and it synced them without any hiccups. Don’t know why, but it works.
  7. Changing the .prf file in ~/.unison/ and running from the command line is a lot faster than loading up the GUI each time and changing the text fields.

The error message that I saw most often was Uncaught exception Invalid_argument("String.sub"). Once that showed up, I’d get disconnected from the server, and had to delete the archive and try again. The -debug option is handy for figuring out what’s going on.

I’m still mounting my home folder from my BSD box onto my mac. But I curse at my slow-as-dirt VPN connection a lot less now that I’m editing code files locally and only transferring the changes without any effort on my part.

Arrr!

Check it out!

It’s the first of many brand universe sites, and in retrospect, hopefully will have been our least satisfying or successful. (If it’s our best, then it means that we’re not improving after this one.) Nonetheless, it was a ton of work by everyone involved, and kind of feels like we all gave birth to a huge baby. With an eyepatch. Hmm… need to work on less disturbing metaphors.

Anyway, go look at the pirates site. And if something breaks, well, I’m sorry :)

See what the blogosphere says about this. Currently, only myself and Ben Margolin have written anything about it, but hopefully that’ll change once there’s some decent marketing sending traffic at it.

Bash Scripts for the Masses! (CVS Helpers)

I decided that I’d share a few little functions in my .bashrc that have been making my life nicer lately. (Yeah, nothing much to blog about. Or rather, I don’t feel like writing anything creative, because my brain is fried from lots of work and being away from home.)

Since we’re in the beginning stages of a project right now, everything is working out of HEAD in the CVS tree. It’s in maintenance modes when you really need to worry about a lot of tagging and branching and whatnot. So, I’ve been finding that it’s easiest to just use the command-line CVS client. Also, I’ve been up in Sunnyvale, working long hours on my laptop in a hotel room. VPN is a lot of things, but it ain’t quick, so my NFS mount has been pretty much worthless most of the time.

So, I wrote a few bash shortcuts so that I can quickly copy *just* my changed files over to my FreeBSD box.

Read the rest of Bash Scripts for the Masses! (CVS Helpers) »