Apologies, title should read "Updating rsync from 2.x to 3.x (because GPLv3 blows chunks)"
Apple bundles rsync
2.6.9 with macOS, and never went past that version because of changes from GPLv2 to GPLv3 .
Without diving into the weeds on why, we needed to update rsync to 3.x, because it can preserve macOS metadata (resource forks [don't laugh PostScript fonts are still a thing], etc.).
While you can use -E
with rsync
2.6.9 to preserve resource forks, a side effect is you lose the ability to run delta syncs. So every time you run rsync, it copies the whole enchilada.
Using rsync
3.x, with -X
preserves macOS metadata including resource forks, but you don't lose full/delta syncing.
The concern we always have when updating anything bundled with macOS is we don't want to cause any issues by tinkering, luckily Apple's /usr/bin/rsync
is not touched when you install the new version which installs in /usr/local/bin/rsync
.
But...that's a problem too, since it makes the new version the one that's used when you invoke rsync
in Terminal...which can piss off developers, and cause problems with any scripts or apps that expect rsync
to just work.
We decided to install into /Library/COMPANY/Applications/rsync
folder, where the binary path would be /Library/COMPANY/Applications/rsync/bin/rsync
.
On a computer that has Xcode installed, we updated to 3.0.6 (since that's the version Mike Bombich trusts enough to bundle with CCC), and applied the patches related to preserving macOS metadata...
# mkdir -p /Library/COMPANY/Applications/rsync
# cd /Library/COMPANY/Applications/rsync
# curl -O http://rsync.samba.org/ftp/rsync/src/rsync-3.0.6.tar.gz
# tar -xzvf rsync-3.0.6.tar.gz
# rm rsync-3.0.6.tar.gz
# curl -O http://rsync.samba.org/ftp/rsync/src/rsync-patches-3.0.6.tar.gz
# tar -xzvf rsync-patches-3.0.6.tar.gz
# rm rsync-patches-3.0.6.tar.gz
# cd rsync-3.0.6
# patch -p1 <patches/fileflags.diff
# patch -p1 <patches/crtimes.diff
# ./prepare-source
# ./configure --prefix=/Library/COMPANY/Applications/rsync
# make
# make install
# cd /Library/COMPANY/Applications/rsync
# rm -Rf rsync-3.0.6
To confirm the new version run:
# /Library/COMPANY/Applications/rsync/bin/rsync --version
rsync version 3.0.6 protocol version 30
Copyright (C) 1996-2009 by Andrew Tridgell, Wayne Davison, and others.
Web site: http://rsync.samba.org/
Capabilities:
64-bit files, 64-bit inums, 64-bit timestamps, 64-bit long ints,
socketpairs, hardlinks, symlinks, IPv6, batchfiles, inplace,
append, ACLs, xattrs, no iconv, symtimes, file-flags
rsync comes with ABSOLUTELY NO WARRANTY. This is free software, and you
are welcome to redistribute it under certain conditions. See the GNU
General Public Licence for details.
Apple confirmed the newly installed /Library/COMPANY/Applications/rsync/
folder is self contained, so it can be deployed, making it possible to use the new version of rsync
without stomping on anything (and pissing off your developers), as long as you specify the new path (can't just use rsync
in your commands, else you'll be invoking the old version).
Once installed, this shows how macOS will continue to use bundled version:
$ rsync --version | head -1
rsync version 2.6.9 protocol version 29
$ /Library/COMPANY/Applications/rsync/bin/rsync --version | head -1
rsync version 3.0.6 protocol version 30
Might also be worth passing word along to your developers so they know the new version is installed, pretty sure they'll use it if they into the macOS metadata problems we ran into.
Now just update your scripts to replace every instance of rsync
with /Library/COMPANY/Applications/rsync/bin/rsync
and you should be all set.
EDIT: Removed this line: "# patch -p1 <patches/hfs-compression.diff" since it does not apply to this version.