Search code examples
macossshosx-yosemitersync

Preserving aliases over OSX ssh rsync


I'm having a devil of a time preserving aliases with rsync over ssh on OSX (Yosemite)

rsync -av -e ssh [email protected]:/Users/me/stuff/ /Users/me/stuff

does not preserve aliases. It makes an alias on the destination... but it doesn't point to the original file (on the destination). Firing up a Finder window, turning on File Sharing on the source, and drag and dropping preserves aliases, but that's the only way I've figured out how to do this so far, and I would prefer a non-GUI solution. Would something besides rsync work over ssh?

I've tried both native OSX rsync as well as Homebrew's.

Thanks super in advance!


Solution

  • Use the -E (or -X on rsync v3) option. Alias files include resource forks. The -E option is documented as:

      -E, --extended-attributes
              Apple specific option  to  copy  extended  attributes,  resource
              forks,  and  ACLs.   Requires at least Mac OS X 10.4 or suitably
              patched rsync.