I use Unison to sync code between my local machine and my dev servers. To sync between two servers, it requires that the same version of Unison be installed on both servers.

Now, this isn’t usually a big deal, because once you get Unison set up, it’s set up. But, I usually get a bit frustrated when setting up a new development machine and ensuring that it has the same Unison version as my remote server.

Most recently, I needed to get Unison 2.48.4 on my local Mac so that it matched my remote server. BUT, homebrew didn’t support Unison 2.48.4.

So, after getting some feedback from one of my coworkers, we came up with the following. Maybe you’ll find it helpful.

# Get rid of existing Unison
brew uninstall --force unison

# Checkout version of homebrew with Unison 2.48.4
cd /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
git checkout 05460e0bf3ae5f1a15ae40315940b2d39dd6ac52 Formula/unison.rb

# Install
brew install --force-bottle unison

# Set homebrew-core back to normal
git checkout master
git reset HEAD .
git checkout -- .

NOTE: If you get error: fatal: reference is not a tree: 05460e0bf3ae5f1a15ae40315940b2d39dd6ac52 after running git checkout 05460e0bf3ae5f1a15ae40315940b2d39dd6ac52 Formula/unison.rb, we’ve been able to fix the issue by recloning homebrew-core. If you get the same error, you’ll want to add these steps before retrying starting at the git checkout 05460e0bf3ae5f1a15ae40315940b2d39dd6ac52 Formula/unison.rb command above.

cd /usr/local/Homebrew/Library/Taps/homebrew
rm -rf homebrew-core
git clone https://github.com/Homebrew/homebrew-core.git
cd homebrew-core

15 thoughts on “Install Unison 2.48.4 on Mac OS X with Homebrew

  1. This post has helped at least to automatticians to fix their unison environment. Thank you! It would have helped three probably, but I lost my faith in unison long ago.

      1. Thanks for the reply. If I try to run git checkout 05460e0bf3ae5f1a15ae40315940b2d39dd6ac52 Formula/unison.rb
        I’m getting the error: fatal: reference is not a tree: 05460e0bf3ae5f1a15ae40315940b2d39dd6ac52

          1. Says that I’m up to date with master and that the remote origins are pointing to the github repo for fetch and push.

  2. Thanks Eric!

    FYI: My git checkout silently failed to overwrite the existing Formula/unison.rb file so I had to remove that before checking it out. If I didn’t, homebrew kept installing the latest version.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.