Skip to content

Instantly share code, notes, and snippets.

@lefant
Created October 9, 2015 04:53
Show Gist options
  • Save lefant/41278798d76a7d7f2424 to your computer and use it in GitHub Desktop.
Save lefant/41278798d76a7d7f2424 to your computer and use it in GitHub Desktop.
how to set up unison on mac os x for dropbox style instant syncing

installing unison on mac

brew install unison

workaround for missing unison-fswatch in brew

sudo pip install macfsevents
curl https://raw.githubusercontent.com/jumpstarter-io/unox/master/unox.py |sudo tee /usr/local/bin/unison-fsmonitor >/dev/null
sudo chmod +x /usr/local/bin/unison-fsmonitor

configure

first set server and user on the server

BOXENITE_SERVER=boxenite.lefant.net
BOXENITE_SERVER_USER=lefant

then configure with the following script snippet

# copy your local ~/.ssh/id_rsa.pub to ~/.authorized_keys on the server
# using ssh-copy-id for convenience:
brew install ssh-copy-id
ssh-copy-id $BOXENITE_SERVER_USER@$BOXENITE_SERVER


cat <<EOF >~/.unison/boxenite.prf
root = $HOME/boxenite
root = ssh://$BOXENITE_SERVER_USER@$BOXENITE_SERVER//home/$BOXENITE_SERVER_USER/boxenite
logfile = $HOME/.unison/unison.log

auto = true
batch = true
prefer = newer
repeat = watch
copyonconflict = true

sshargs = -q -o VisualHostKey=no -C
retry = 1
#debug = all
EOF

run it

you should now be able to run the following command which will spin up unison and keep it running, watching for file changes locally or remotely and syncing them to the other end

unison boxenite
@m-f-g
Copy link

m-f-g commented Jul 31, 2017

what version of unison is needed to run instant sync ?

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