I have a problem with using rsync for backuping files on my remote linux machine to my Mac. The first time all is well, but apparently there is a problem with special characters between the mac and linux machine, since every time I run the rsync operation after that, the files with special characters are first deleted and then re-synced. It seems as if there is a problem with different character sets.
The preferred solution seems to be to use the --iconv
option:
You can use rsync's --iconv option to convert between UTF-8 NFC & NFD, at least if you're on a Mac. There is a special utf-8-mac character set that stands for UTF-8 NFD. So to copy files from your Mac to your NAS, you'd need to run something like:
rsync -a --iconv=utf-8-mac,utf-8 localdir/ mynas:remotedir/
This will convert all the local filenames from UTF-8 NFD to UTF-8 NFC on the remote server. The files' contents won't be affected.
That sounds all and well, but my mac does not seem to recognise that option, since I get:
> MyMachine:~ Macuser$ /usr/bin/rsync -av --delete --iconv=utf-8,utf-8-mac user@linuxmachine:/home/linuxuser/Test/ /Users/Macuser/Test/
> rsync: --iconv=utf-8,utf-8-mac: unknown option
> rsync error: syntax or usage error (code 1) at /SourceCache/rsync/rsync-42/rsync/main.c(1333) [client=2.6.9]
Any suggestions on what to do?
EDIT: the rsync version on my mac is 2.6.9.
Macuser$ rsync --version
rsync version 2.6.9 protocol version 29
If that version does not support the --iconv
option, how do I update in a safe manner?
EDIT: I finally figured out that apart from updating rsync, I also had to switch the order in which I specified the character sets, so I added an answer below.