Installing Unison on Windows

As I mentioned earlier on Twitter, I use Unison to synchronize my computers. This works great and I truly think Unison is a great tool, but when it comes to synchronize a Windows machine, it is a (little) pain to set it up correctly. Before we start, I like to say, that this is one of the reasons that a lot of open source tools don’t get the credits they deserve.

Unison is a great tool, but with this kind of installation procedures a lot of people will give it up and look for alternatives. Maybe a native Windows application is worth the effort? A little note before we truly start, consider downloading binary versions, they are a lot easier to set-up. Unfortunately I was planning on do that, but the website which hosts the binaries was(is?) down at that moment.

Make sure you always download the same versions for all your systems which you like to synchronize. (cause 2.27.57 is in the Ubuntu repositories, I stick with that one). Enough complaining, let’s start.

First we need to install Cygwin, this is kind of Bash emulator for Windows. They call it a Linux-like environment for Windows. You can get it here: http://www.cygwin.com/ Go to the bottem of the page and click “Install or update now!”, it will download an executable, called setup.exe. Before you run setup.exe, make sure you have an Internet connection. The setup will look for available repositories, choose one and click next. The most important screen is the package selection screen. Make sure you install “openssh” and the “gcc/make” tools, if you’re unsure just select the complete “devel” package.

After installation you can remove this one. When Cygwin is installed, we can download the source for the Caml compiler. Which can be downloaded here: http://caml.inria.fr/download.en.html I used version 3.11, cause the newer ones gave errors when compiling Unison. This is probably fixed in newer releases of Unison. Go to “C:cygwinhomeuser” and make a directory called tools. Un(g)zip and untar the caml package and place it in here. So you get “C:cygwinhomeusertoolsocaml-3.1x.x”. If you also need 3.11 and it isn’t directly available from the site, you can use this link: http://caml.inria.fr/pub/distrib/ Now start Cygwin and go to this directory, by default you are already at “home” so this should do the trick.

cd toolsocaml-3.1x.x

Now type

./configure make world && make opt && make install

This can take a while. Now go to the Unison site ( http://www.cis.upenn.edu/~bcpierce/unison/) and download the version you like to compile. Take the same steps as we did for the Caml compiler. So un(g)zip and untar the packages and place it in the directory tools. In Cygwin go to the Unison directory by typing (depending on your version)

cd ../unison-2.27.57

Now let’s compile

make UISTYLE=text

Please note this makes only the text based version, which is enough for me, cause I like to automate things. The new unison.exe is placed in the Unison directory, so for a quick run.

./unison –help

If you have a profile in your “/home/user/.unison” directory, you can use such a syntax to automate things.

./unison “default” -auto -batch -ui text

Good luck! If you also like to create the GTK version, you need to install the LablGtk 1.2.3 which is fully covered in the “INSTALL.win32-cygwin-gnuc” file, which comes with the source package of Unison. If you have any troubles with this, please let me know.

Rob Maas
Rob Maas
Technical Challanger at ON2IT

If it is broken, fix it! If it ain’t broken, make it better!