Issue using rsync on MacOS to copy Apple Mail

I use rsync to mirror my files on the Mac to an external “backup” drive. I don’t actually use rsync for backups in the true sense, just as a basic “mirror” of the existing Mac as it is at the moment. The general command is as follows:

rsync -av --delete --progress {sourceDir} {destDir}

However, when I tried to make a mirror of my Apple Mail folder I was getting errors with extended attributes and permission errors.

  • rsync error: some files/attrs were not transferred
  • rsync: opendir “/Users/remejy/Library/Mail/.” failed: Operation not permitted (1)

I thought it was because I had an older version of rsync (2.6.9), so I upgraded to rsync (3.1.3), which did not solve the issues. I tried adding various flags like -X and -H and –fileflags, but none of those helped either. Until I got lucky and came across an Apple Forum thread on rsync operation not permitted error. One of the responses said that due to MacOS Catalina protections on various folders, you would need to add the Terminal app to the “Full Disk Access” Privacy settings in “Preferences” > “Security & Privacy” (see next image)

Once I added “Terminal.app”, and closed and reopened Terminal, I was now able to mirror my Apple Mail directory!

One Comment

Add a Comment

Your email address will not be published. Required fields are marked *