Discussion:
[unison-users] binary (command-line tool) version of Unison on macOS
Stefan Moser stefan.moser@alumni.ethz.ch [unison-users]
2018-11-14 17:51:34 UTC
Permalink
Dear all,

silly question: I'm trying to keep several Unison versions installed on my machine (macOS 10.14.1): my main Unison version 2.51.2, and also one version 2.48.15 which I have renamed "Unison-2.48" in the /Application folder. I need the older version in order to synchronize with some linux servers outside of my control where 2.48 is installed. The binary, however, should be 2..51.2 only, because whenever I contact my Mac from outside, I want to call the 2.51.2-unison.

However, this doesn't seem to work: for some users, 2.52.2 shows up, but for some 2.48.15. And I haven't understood when and why which version is called. So the binary unison that is installed in /usr/local/bin seems to do something strange. Can someone explain to me how this is implemented? And how can I make sure that the binary in /usr/local/bin always and exclusively points to the 2.52.2 Unison?

Thanks!

Stefan

__
Stefan M. Moser <***@protonmail.ch>
Senior Researcher & Lecturer, ETH Zurich
Adj. Professor, National Chiao Tung University
Mathematiklehrer, Kantonsschule Uster
Web: http://moser-isi.ethz.ch/
Alan Schmitt alan.schmitt@polytechnique.org [unison-users]
2018-11-19 15:27:05 UTC
Permalink
(Resending because I used the wrong from address the first time.)
Post by Stefan Moser ***@alumni.ethz.ch [unison-users]
silly question: I'm trying to keep several Unison versions
installed
on my machine (macOS 10.14.1): my main Unison version 2.51.2,
and also
one version 2.48.15 which I have renamed "Unison-2.48" in the
/Application folder. I need the older version in order to
synchronize
with some linux servers outside of my control where 2.48 is
installed.
The binary, however, should be 2.51.2 only, because whenever I
contact
my Mac from outside, I want to call the 2.51.2-unison.
However, this doesn't seem to work: for some users, 2.52.2 shows
up,
but for some 2.48.15. And I haven't understood when and why
which
version is called. So the binary unison that is installed in
/usr/local/bin seems to do something strange. Can someone
explain to
me how this is implemented? And how can I make sure that the
binary in
/usr/local/bin always and exclusively points to the 2.52.2
Unison?
The command line version of Unison for OS X is just a small
wrapper that
searches for an installed Unison, so if there are several versions
installed this will not be deterministic.

If you need a command-line version of unison, I recommend using
homebrew
to install it, or install ocaml and compile it directly (the
command
line version does not have any other dependency than OCaml).

Best,

Alan
joerg van den hoff j.van_den_hoff@hzdr.de [unison-users]
2018-11-19 15:55:07 UTC
Permalink
Post by Alan Schmitt ***@polytechnique.org [unison-users]
(Resending because I used the wrong from address the first time.)
Post by Stefan Moser ***@alumni.ethz.ch [unison-users]
silly question: I'm trying to keep several Unison versions installed
on my machine (macOS 10.14.1): my main Unison version 2.51.2, and also
one version 2.48.15 which I have renamed "Unison-2.48" in the
/Application folder. I need the older version in order to synchronize
with some linux servers outside of my control where 2.48 is installed.
The binary, however, should be 2.51.2 only, because whenever I contact
my Mac from outside, I want to call the 2.51.2-unison.
However, this doesn't seem to work: for some users, 2.52.2 shows up,
but for some 2.48.15. And I haven't understood when and why which
version is called. So the binary unison that is installed in
/usr/local/bin seems to do something strange. Can someone explain to
me how this is implemented? And how can I make sure that the binary in
/usr/local/bin always and exclusively points to the 2.52.2 Unison?
The command line version of Unison for OS X is just a small wrapper that
searches for an installed Unison, so if there are several versions
installed this will not be deterministic.
just out of curiosity: in what sense will this lookup "not be deterministic"? the wrapper should
simply find the first executable on the search path, no? even if some OSX-specific search path magic
is going on under the hood.

as I understand the mail of the OP, I would guess that he is actually having some search path
issues. if there are several users, their searchpaths might differ and this might be the reason, why
for different users different unison versions are started.

br/joerg
Post by Alan Schmitt ***@polytechnique.org [unison-users]
If you need a command-line version of unison, I recommend using homebrew
or macports (`port install unison -gtk -aqua', to get rid of the GUI...)
Post by Alan Schmitt ***@polytechnique.org [unison-users]
to install it, or install ocaml and compile it directly (the command
line version does not have any other dependency than OCaml).
Best,
Alan
Alan Schmitt alan.schmitt@polytechnique.org [unison-users]
2018-11-19 16:14:30 UTC
Permalink
Post by joerg van den hoff ***@hzdr.de [unison-users]
Post by Alan Schmitt ***@polytechnique.org [unison-users]
The command line version of Unison for OS X is just a small
wrapper that
searches for an installed Unison, so if there are several
versions
installed this will not be deterministic.
just out of curiosity: in what sense will this lookup "not be
deterministic"?
the wrapper should simply find the first executable on the
search path, no? even
if some OSX-specific search path magic
is going on under the hood.
as I understand the mail of the OP, I would guess that he is
actually having
some search path issues. if there are several users, their
searchpaths might
differ and this might be the reason, why for different users
different unison
versions are started.
IIRC, the lookup uses an application database maintained by OS X.
(I
think an application needs to be launched once to be in it, but
then it
will be there.)

https://github.com/bcpierce00/unison/blob/master/src/uimac14/cltool.c#L31

I should not have said "non-deterministic", but that I have no
idea how
an application is picked when several have the same identifier.

Best,

Alan

Loading...