How to use rsync via ssh with IPv6 LLA (link local address) addresses on OSX?

I'm using OSX High Sierra and bash. I'm trying to use a backup script based on IPv6 LLA (so I always reach the server, without DHCP, names etc).

With IPv4 this works:

rsync -e ssh /src/dir/* [email protected]:/dst/dir

On Linux/Bash this works:

rsync -e ssh /src/dir/* user@[fe80::a:b:c:d%eth0]:/dst/dir

But on OSX terminal this didn't work.

ssh: Could not resolve hostname [fe80: nodename nor servname provided, or not known
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: error in rsync protocol data stream (code 12) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-52/rsync/io.c(453) [sender=2.6.9]

I've tried a lot of quotes combinations but without success.

Thank you!


The problem was with the OSX version of rsync. I don't know exactly what is the problem. It should be some of capabilities of rsync binary/version.

OSX version:

/usr/bin/rsync --version
rsync  version 2.6.9  protocol version 29
...
Capabilities: 64-bit files, socketpairs, hard links, symlinks, batchfiles,
              inplace, IPv6, 64-bit system inums, 64-bit internal inums

Installing a version from macports:

/opt/local/bin/rsync --version
rsync  version 3.1.2  protocol version 31
...
Capabilities:
    64-bit files, 64-bit inums, 64-bit timestamps, 64-bit long ints,
    socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace,
    append, ACLs, xattrs, iconv, symtimes, no prealloc, file-flags,
    HFS-compression

Although both have the IPv6 support, this 2.6.9 distributed with OSX doesn't work as expected.

With 3.1.2 I can use:

rsync -e ssh /src/dir/* user@[fe80::a:b:c:d%eth0]:/dst/dir

Thanks for helping.