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.

rkosegi
  • 14,165
  • 5
  • 50
  • 83
InvalidSyntax
  • 9,131
  • 20
  • 80
  • 127

5 Answers5

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
lennart
  • 29
  • 3
2

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

Paolo Moschini
  • 352
  • 3
  • 3
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.

Henrik Pingel
  • 3,083
  • 1
  • 19
  • 27
-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
mattias
  • 2,079
  • 3
  • 20
  • 27
  • Just tried these steps, no effect seems to have taken place. Running `which unison` still returns nothing. – InvalidSyntax Nov 07 '17 at 19:20
  • 1
    What does _echo $PATH_ return? – mattias Nov 07 '17 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... – Mark Setchell Nov 07 '17 at 20:05