macOS Catalina causing "find: .: Operation not permitted" errors

Solution 1:

You need to grant the Finder full disk access:

  1. Open Security & Privacy preferences
  2. Go to the Full Disk Access option.
  3. Click the plus button.
  4. Locate the Finder in /System/Library/CoreServices/ (or simply type 'Finder' into Search).

Compare Grant “Full Disk Access” to Workflows run via the Services menu.

Solution 2:

I had a somewhat related issue. I created a periodic script that was running under /etc/daily.local. This was on macOS Catalina. It had the following line:

find "/Users/brianc/Downloads" -Btime +3d -name 'GBH4SN2*.rdp' -type f -print

And when the script ran, I would see the following:

find: /Users/brianc/Downloads: Operation not permitted

So, I granted Full Disk Access (System Preferences > Security & Privacy > Privacy > Full Disk Access) to find. No difference. Granted FDA to bash. No difference. Granted FDA to sh. No difference. Finally, by going through all the different scripts, I found that periodic scripts are run under /usr/libexec/periodic-wrapper which is executed from /System/Library/LaunchDaemons/com.apple.periodic-daily.plist. So, I granted FDA to periodic-wrapper. Problem solved.