I am quite confused as to why rsync requires --rsync-path flag even when remote rsync is in path.


$ rsync -avze 'ssh -p 22' --delete public/ [email protected]:~/public_html
bash: /usr/local/bin/rsync: No such file or directory
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: remote command not found (code 127) at io.c(601) [sender=3.0.7]

then I tried adding --rsync-path

$ rsync -avze 'ssh -p 22' --rsync-path=/usr/bin/rsync  --delete public/ [email protected]:~/public_html
sending incremental file list

So, the first rsync was not successful because it was searching for rsync in /usr/local/bin but as soon as I pass the obvious path for rsync using --rsync-path, then it works.

Why is this? (this command line is the one issued by rake deploy in octopress)

  • Do you have any forced commands at the destination end? Anything in the .bashrc or .profile that might set a local environment variable? Oct 17, 2012 at 12:20
  • $ cat ~/.bashrc | grep PATH returns nothing. Oct 17, 2012 at 13:52
  • If you just ssh in yourself and run which rsync what do you get? Oct 17, 2012 at 13:56
  • 2
    $ ssh [email protected] which rsync returns /usr/bin/rsync Oct 17, 2012 at 15:07
  • 1
    Weird. Clutching at straws, now: Is perhaps your local rsync aliased to rsync --rsync-path (or some other local wrapper)? Oct 17, 2012 at 16:18

1 Answer 1


My memory is now quite fuzzy on this but the reason this was happening was that I used GNU stow on rsync at some point and created some symlinks that confused rsyncs location. This was sorted after much hair-pulling. I am now much lighter on hair but on the other hand I have a working rsync. That must be a win if you ask me.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .