Posted in Tutorials
You have to run your program on a remote server. However your favourite editor with your favourite configuration isn’t available over SSH. Or its over-SSH mode is very slow (looking at you, TRAMP). Also, you’d like to work online sometimes.
Unison is like Dropbox but without an intermediary server.
Setting it up
First, you need to have two1 directories, one in your local machine and one in
your remote machine, that will be synchronised. For example,
/local/path/to/my/software in your local machine and
in your remote server. You must have SSH access to the server, which is for
Then you download and
Preferrably use your system’s package. You need two executables:
unison-fsmonitor. The second one is not always available with the
package: it is not there, for example on Ubuntu or OS X. To install it:
- Ubuntu: install the
ocamlpackage to compile Unison from source. Then just run
make. It might give an error, but with a little bit of luck you will have compiled the
unison-fsmonitorexecutable before that. Copy it to your
- OS X: install UNOX
Now you have to set up a “profile” configuration file in your local machine. In
$HOME/.unison/profile-name.prf, write something like:
root = /local/path/to/my/software root = ssh://user@host//remote/path/software ignore = Regex ^(.*/)*[^/]*\.[^/]*$ ignorenot = Regex ^(.*/)*[^/]*\.(py|txt|md|ipynb|bash|gitignore)$
This will synchronize all files ending in
.md… or having no
“.” in their filename, between the two directories mentioned at the beginning.
Read more about how the
Finally, in your local machine, run:
unison profile-name -repeat watch -times -logfile /var/log/unison.log
And the directories shall be synchronized.
- Or more, but we will only set up two here. [return]