Skip to content

Instantly share code, notes, and snippets.

@pch
Last active February 18, 2019 08:57
Show Gist options
  • Star 8 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save pch/aa1c9c4ec8522a11193b to your computer and use it in GitHub Desktop.
Save pch/aa1c9c4ec8522a11193b to your computer and use it in GitHub Desktop.
How to install Unison on Mac OS El Capitan & Vagrant

How to install Unison on Mac OS El Capitan & Vagrant - for Docker Sync

You can install Unison on the Mac via homebrew (brew install unison), but it's very likely that it won't work properly, resulting in errors like:

Unison failed: Uncaught exception Failure("input_value: bad bigarray kind")
Fatal error: Lost connection with the server

To solve this problem, you have to make sure that Unison is compiled with the same version of ocaml on both Mac & Vagrant. And this requires some manual work.

Here are the steps involved:

Install Unison on Mac OS

# See: https://github.com/Homebrew/homebrew/issues/37378
brew tap Caskroom/cask
brew install Caskroom/cask/xquartz
cd `brew --prefix`/Library
git checkout 924387b `brew --prefix`/Library/Formula/objective-caml.rb # check out ocaml-4.01
brew install objective-caml # this will take a while
git reset . && git clean -f # clean up

cd /tmp
curl -O http://www.seas.upenn.edu/~bcpierce/unison//download/releases/stable/unison-2.48.3.tar.gz
tar -xvzf unison-2.48.3.tar.gz
cd unison-2.48.3
make UISTYLE=text
sudo cp unison /usr/local/bin

Install Unison on Vagrant (Ubuntu 14.04)

sudo apt-get update
sudo apt-get install -y ocaml=4.01.0-3ubuntu3

cd ~
curl -O http://www.seas.upenn.edu/~bcpierce/unison//download/releases/stable/unison-2.48.3.tar.gz
tar zxvf unison-2.48.3.tar.gz
cd unison-2.48.3
make UISTYLE=text NATIVE=false
sudo cp unison /usr/local/bin/

That's it. Unison sync should now work properly between Mac OS & Ubuntu on Vagrant.

@michaelsauter
Copy link

BTW, for Ubuntu you can fix the version, e.g. sudo apt-get install -y ocaml=4.01.0-4ubuntu1

@michaelsauter
Copy link

Could you add the vagrant stuff to the vm/provision.sh script in your pull request? Then the setup is a little easier since you only have to do the host part. Even that could be put into a script to make it easier to use. Just make sure at the top of the script that all requirements (e.g. brew) are installed.

@muellerix
Copy link

Thank you - worked for me with El Capitan und Ubuntu 12.04 LTS

@dportabella
Copy link

running make UISTYLE=text on my OSX10.10.5 fails on:

File "/tmp/unison-2.48.3/system.ml", line 1:
Error: The implementation /tmp/unison-2.48.3/system.ml
       does not match the interface system.cmi:
       Values do not match:
         val symlink : ?to_dir:bool -> string -> string -> unit
       is not included in
         val symlink : string -> fspath -> unit
make: *** [system.cmx] Error 2

any idea?

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