I have been working on putting together a simple bash script to backup my client’s macOS users files to a local NAS in their office. I put this script in a cron job in my macOS Big Sur, but kept getting Operation not permitted” error in my macOS Big Sur machine. WTF!
Crazy thing was that the script worked when I ran it directly on my terminal, but it gave me the above error when I placed it in my crontab. I decided to brew my coffee at home before troubleshooting this issue with this operation not permitted error in macOS.
It turns out the issue is with macOS Big Sur permissions for cron daemon.
Grant cron Full Disk permissions to fix operation not permitted error in macOS
You need to go to your Security & Privacy settings in your macOS and unlock it by clicking on the ‘lock’ bottom left corner. Then do this:
- Go to the Privacy tab and select Full Disk Access.
- Under the list of apps on the right panel click on ‘+’.
- Use keyboard shortcut: Command+Shift+G to open “Go to Folder”.
- Navigate or enter path: /usr/sbin/cron and select Go.
- Make sure ‘cron’ now appears in the list of apps with Full Disk Access.
- You may also need to add ‘smbd’ and ‘Terminal’ to the list. Use the same process indicated above.
Now, try again and test your cron job and let me know if it works. You can contact me if you have any questions. Also, check out some of my coffee mugs and T-Shirt designs inspired by technology: