3

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.

4
  • Care to share the error output?
    – mattias
    Commented Nov 7, 2017 at 18:55
  • Updated my original post to include the original command and error Commented Nov 7, 2017 at 18:56
  • What output does which unison give you?
    – mattias
    Commented Nov 7, 2017 at 18:59
  • Literally returns nothing Commented Nov 7, 2017 at 18:59

5 Answers 5

4

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

2
  • This is the only thing that finally worked. Commented Feb 29 at 22:12
  • Setting this option also worked for me. Thanks mate. Commented Sep 1 at 22:20
2

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
2

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
1

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.

-2

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
3
  • Just tried these steps, no effect seems to have taken place. Running which unison still returns nothing. Commented Nov 7, 2017 at 19:20
  • 1
    What does echo $PATH return?
    – mattias
    Commented Nov 7, 2017 at 19:32
  • I think the point of homebrew is that it creates symbolic links in /usr/local/bin which you are supposed to use so you don’t have to change your scripts when you install newer versions and so you don’t have to include the path to every single package in your PATH - you just add /usr/local/bin to your PATH and you are all set to go... Commented Nov 7, 2017 at 20:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.