macOS "can not obtain extended attribute com.apple.macl"

Hello,

I am on macOS Catalina, and by running restic -r /path/to/dir --password-file /path/to/dir backup /path/to/dir --exclude-file /path/to/dir from a cron job, I am getting the following errors:

can not obtain extended attribute com.apple.macl for /Users/ChrisLL/Desktop:

error: Open: open /Users/ChrisLL/Desktop: operation not permitted

can not obtain extended attribute com.apple.macl for /Users/ChrisLL/Documents:

error: Open: open /Users/ChrisLL/Documents: operation not permitted

can not obtain extended attribute com.apple.macl for /Users/ChrisLL/Downloads:

error: Open: open /Users/ChrisLL/Downloads: operation not permitted

can not obtain extended attribute com.apple.macl for /Users/ChrisLL/Pictures/Photos Library.photoslibrary:

can not obtain extended attribute com.apple.quarantine for /Users/ChrisLL/Pictures/Photos Library.photoslibrary:

error: Open: open /Users/ChrisLL/Pictures/Photos Library.photoslibrary: operation not permitted

However, if I run it from the command line, everything works. What’s wrong?

Thanks.

This should work:

  • Turn your restic command into a simple bash script.
  • Wrap that bash script into a macOS .app using Platypus - Create Mac apps from command line scripts.
  • Give that generated application Full Disk Access in System Settings.
  • Schedule the application to run using cron using /usr/bin/open -ga $HOME/Applications/Backup.app (adjust the .app name or path to it accordingly).