My problem is
$ ssh localhost fswatch
bash: fswatch: command not found
when without SSH command (i.e. fswatch) works fine.
I found that PATH in SSH session is default Mac’s
$ ssh localhost echo $PATH
since without SSH
$ echo $PATH
I really do not remember how have I set up the PATH, but sure
~/.bash_profile do not edit PATH variable. There is a config file
$ cat /etc/paths
Homebrew, npm, pip usually install programs to
/usr/local/bin, so all installed programs are there and I can’t access them via
ssh localhost command on my MacOS. There is no problem with Linux.
So my question is how to configure OpenSSH to use PATHs from
I also tried to hack:
$ ssh localhost sh -lc 'echo empty;echo $PATH'
$ ssh localhost bash -lc 'echo empty;echo $PATH'
first line is always empty, don’t you know why?
And my final workaround
$ ssh localhost bash -lc ':;
export PATH="$( cat /etc/paths /etc/paths.d/* | tr \\n : )";
Copyright (C) 2013-2018 Enrico M. Crisostomo <firstname.lastname@example.org>.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Written by Enrico M. Crisostomo.
:; is important because first command is somehow dropped from execution
System: MacOS Mojave 10.14.5
OpenSSH_7.9p1, LibreSSL 2.7.3
GNU bash, version 5.0.7(1)-release (x86_64-apple-darwin18.5.0)
Get this bounty!!!