

When you connect to localhost you can leverage the which command: $ ssh localhost $(which fswatch). So the easiest solution to this problem is to just provide the full path to the executable, like: $ ssh localhost /full/path/to/fswatch This is the most stable and secure solution to this problem and will always work! When an interactive shell that is not a login shell is started, bashįrom /etc/bash.bashrc and ~/.bashrc, if these files exist. bashrc file if you do not run an interactive shell: All communication with the remoteĬommand or shell will be automatically encrypted. When the user's identity has been accepted by the server, the serverĬommand in a non-interactive session or, if no command has been specified, logs into the machineĪnd gives the user a normal shell as an interactive session. The reason for the observed behavior is, that your command will not run in an interactive but a non-interactive shell: Here first : is important because first command is somehow dropped from executionīash -version GNU bash, version 5.0.7(1)-release (x86_64-apple-darwin18.5.0)įor my answer I assume you are using the Bourne Again SHell, but the following is true for most other shells as well: There is NO WARRANTY, to the extent permitted by law. This is free software: you are free to change and redistribute it. License GPLv3+: GNU GPL version 3 or later. usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Applications/VMware Fusion.app/Contents/PublicĬopyright (C) 2013-2018 Enrico M. $ ssh localhost bash -lc 'echo empty echo $PATH'įirst line is always empty, don't you know why? And my final workaround $ ssh localhost bash -lc ': Įxport PATH="$( cat /etc/paths /etc/paths.d/* | tr \\ I also tried to hack: $ ssh localhost sh -lc 'echo empty echo $PATH'
#Add to path osx how to#
So my question is how to configure OpenSSH to use PATHs from /etc/paths and /etc/paths.d?
#Add to path osx install#
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 a config file /etc/paths: $ cat /etc/paths

I really do not remember how have I set up the PATH, but sure ~/.bashrc and ~/.bash_profile do not edit PATH variable. Too often, people just download the latest Python release, move it to their path, and call it a day (or use brew install python3, which would do something. I found that PATH in SSH session is default Mac's $ ssh localhost echo \$PATH
