3

I'm in the process of porting scripts which use rsync to MacOS 10.15.7.

Typical commands in these scripts look like

rsync -rau --delete SOURCE DESTINATION

Is there a way to display, which files have been deleted from DESTINATION? On Linux, I would use the option --info=del, but on the Mac version of rsync, --info does not exist, as we can see in the man-page.

2 Answers2

7

The version of rsync supplied by Apple is very old (at least 17 years) it is version version 2.6.9 (which just happens to be the last rsync version released under GPL 2)

So the best fix for your issue is to install a modern version of rsync. It is available from all package mangers e.g. Macports, Homebrew.

mmmmmm
  • 30,160
  • AFAIK, Apple's version of rsync does include an option for backing up extended attributes. – Seamus Apr 20 '23 at 17:14
  • Apple is avoiding GPL3 everywhere. To my understanding that was also the reason to switch from bash to zsh. – Thorbjørn Ravn Andersen Apr 21 '23 at 07:07
  • 1
    From man -M /usr/share/man rsync: -E, --extended-attributes copy extended attributes, resource forks, so Apple's version does support extended attributes and resource forks. – nohillside Apr 21 '23 at 08:01
  • The issue is so old I have forgotten the details - but might be that vanilla rsync did not support extended attributes but Apple had forked it which I did not realise. There were other issues. – mmmmmm Apr 21 '23 at 11:46
7

If you're intent on using the ancient Apple version of rsync, you might find the --dry-run option with the -i and -v (or -vv) options useful for listing the deletions.

rsync -rauivv --dry-run --delete SOURCE DESTINATION

If you want an affirmative record of what has been deleted, you could use the --backup-dir= option to actually save a copy of what's been deleted in a separate folder on the DEST (which could later be deleted).

rsync -rau --delete --backup-dir=/the/destination/backup SOURCE DESTINATION

Perhaps the easiest thing to do is avoid the porting process altogether by getting a current version of rsync via a 3rd party package manager: either MacPorts (recommended), or Homebrew.

You might also find this answer worth a read.

Seamus
  • 4,547