If I ssh into an osx box from a linux box, issuing socat works fine. However, if I give the socat command as argument to ssh it fails. socat was installed in osx using brew. Any idea why this is happening?

This works:
  $ ssh daniel@remoteOSX
  $ socat -d -d SYSTEM:date -
  < date shows up here :) >

This fails:
  $ ssh daniel@remoteOSX 'socat -d -d SYSTEM:date -'
  bash: socat: command not found                                <-- The ERROR

1 Answer 1


Clearly, plain ssh does not use your PATH. Recreate your environment by spawning a login shell.

ssh daniel@remoteOSX 'bash -lc "socat -d -d SYSTEM:date -"'

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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