Resources‎ > ‎unison‎ > ‎

How to use unison

You might use unison for 'one-off' bidirectional synchronisation of folders/directories.  However, it's very likely that you would want to repeat such synchronisation on certain folders/directories.  The following describes how to setup folder synchronisation on certain folders using unison.

Create a unison preference file

Since you may have various folders you wish to sync, it might be better to create a unison preference file for each folder you wish to sync.  A unison preference file should be stored in $HOME/.unison directory.  If you don't have this directory, you can simply create one.

In this directory, you can create a unison preference file somefolder.prf

# Unison preference file for /Users/usename/somefolder
root = /Users/username/somefolder
root = ssh://
# for Mac OS X, the following will enable resource fork
# rsrc = true 
perms = 0
prefer = newer
batch = true
servercmd = /usr/bin/unison
ignore = Name *~
ignore = Name .*~
ignore = ._*

Execute unison

Once you have a preference file, you can execute unison with this preference file as:

unison somefolder.prf 

Automate synchronization