Unison command not found

Viewed 3029

Recently my Unison application has stopped working on my Mac terminal saying the command cannot be found. Not sure if this was the reason but I recently reinstalled brew (which is how it was installed), which may have broken it.

Here is the error output:

mac:~ Imran$ unison sites
-bash: unison: command not found

I can see that if I locate unison unison is found in the following directories:

> /Users/Imran/unison.log /Users/Imran/unison.tar.gz
> /usr/local/Cellar/unison /usr/local/Cellar/unison/2.40.102
> /usr/local/Cellar/unison/2.40.102/COPYING
> /usr/local/Cellar/unison/2.40.102/INSTALL_RECEIPT.json
> /usr/local/Cellar/unison/2.40.102/NEWS
> /usr/local/Cellar/unison/2.40.102/README
> /usr/local/Cellar/unison/2.40.102/TODO.txt
> /usr/local/Cellar/unison/2.40.102/bin
> /usr/local/Cellar/unison/2.40.102/bin/unison
> /usr/local/Library/Formula/unison.rb
> /usr/local/Library/LinkedKegs/unison /usr/local/bin/unison
> /usr/local/opt/unison /usr/share/zsh/5.3/functions/_unison

Can someone help me get this working again? I suspect its something to do with the link to the app being broken.

5 Answers

If you've done a reinstall of a brew cask, you may need to manually link it again if it can't be found on your path

brew link unison

According to the documentation the error message bash: unison: command not found means:

Make sure Unison is installed on the host you are trying to connect to.

For anyone running into this error on macOS: If you're using zsh (or running a newer macOS version where zsh is the default) you have to modify or create ~/.zshenv.

Add your path to the shell environment by adding one of the following snippets to ~/.zshenv.

For ARM64 (M1 Macs):

eval $(/opt/homebrew/bin/brew shellenv)

or on x86 (Intel Macs)

eval $(/usr/local/bin/brew shellenv)

or you simply source your zshrc:

source ~/.zshrc

I had the same issue when trying to use Unison from Windows to Mac (where it has been installed with Brew).

You can give an explicit path for the unison executable on the server by using the command-line option

-servercmd /full/path/name/of/unison

or adding

servercmd=/full/path/name/of/unison

to your profile

Source

Your user's PATH variable does not include a link to the unison binary.

Add /usr/local/Cellar/unison/2.40.102/bin/unison to your .bashrc,

$ vi ~/.bashrc

add the following,

export PATH=$PATH:/usr/local/Cellar/unison/2.40.102/bin/unison

save and quit, and then re-read your users bashrc file,

exec bash

Now try which unison again, or actually just try running it with,

$ unison
Related