I have a script which runs rsync
on my ~/Library/Preferences/ folder:
#!/bin/zsh -f
SOURCE="$HOME/Library/Preferences"
TARGET="$HOME/Dropbox/Backups/Preferences/$HOST"
LOG="$HOME/logs/$HOST/${NAME}.log"
[[ ! -d "$LOG:h" ]] && mkdir -p "$LOG:h"
[[ ! -e "$LOG" ]] && touch "$LOG"
/usr/bin/rsync \
--8-bit-output \
--human-readable \
--itemize-changes \
--progress \
--safe-links \
--links \
--times \
--delete \
--recursive \
--checksum \
--verbose \
--exclude='.DS_Store' \
--log-file="$LOG" \
"${SOURCE}/" \
"${TARGET}/"
exit 0
#EOF
This script works with no errors from iTerm.
However, when I try to run it via launchd
I consistently get errors about 3 files:
- com.apple.homed.notbackedup.plist
- com.apple.homed.plist
- com.apple.mail-shared.plist
Here's an example:
building file list ...
511 files to consider
*deleting com.contextsformac.Contexts.plist.JkbicFf
.d..t.... ./
rsync: send_files failed to open "/Users/luomat/Library/Preferences/com.apple.homed.notbackedup.plist": Operation not permitted (1)
rsync: send_files failed to open "/Users/luomat/Library/Preferences/com.apple.homed.plist": Operation not permitted (1)
rsync: send_files failed to open "/Users/luomat/Library/Preferences/com.apple.mail-shared.plist": Operation not permitted (1)
>fc.t.... com.contextsformac.Contexts.plist
3.10K 100% 0.00kB/s 0:00:00 (xfer#4, to-check=249/511)
.f..t.... com.setapp.DesktopClient.plist
>fcst.... test-ignore.txt
203 100% 198.24kB/s 0:00:00 (xfer#5, to-check=75/511)
sent 31.63K bytes received 142 bytes 63.55K bytes/sec
total size is 3.42M speedup is 107.49
rsync error: some files could not be transferred (code 23) at /BuildRoot/Library/Caches/com.apple.xbs/Sources/rsync/rsync-52.200.1/rsync/main.c(996) [sender=2.6.9]
I assume this has something to do with Mojave's security because I have access to the files:
$ ls -l com.apple.homed.* com.apple.mail-shared.plist
-rw------- 1 luomat staff 184 Sep 12 00:43 com.apple.homed.notbackedup.plist
-rw------- 1 luomat staff 567 Sep 13 09:53 com.apple.homed.plist
-rw------- 1 luomat staff 225 Aug 18 23:44 com.apple.mail-shared.plist
What I have tried
- I have given
/usr/bin/rsync
"Full Disk Access" in System Preferences - I have tried
rsync
from homebrew/usr/local/bin/rsync
and given it "Full Disk Access" - I have given
/sbin/launchd
"Full Disk Access"
Now what?
Given that it does not give any errors when not in launchd
what should I try now?
${NAME}
initialized with a value in the script. But, that not going to fix theOperation not permitted
error.