macOS cron Permission Issues

I use macOS at work, and I have a number of cron jobs that I set to run.

One of the jobs run’s on a regular basis, and is supposed to delete the public/ directory of a Hugo static site, and then rebuild the site. Trouble is it always fails to remove the directory because it doesn’t have permissions to do it.

rm: /Users/jprice/drive/my/files/documents/log/public: Operation not permitted

It’s a “simple” enough fix. To get around it you have to give /usr/sbin/cron Full Disk Access in macOS.

To do that go to “System Settings > Privacy & Security > Full Disk Access”, and click to the + to add cron. There’s no command you can run to do this in one it seems ☹️ and you’ll need admin permissions.

About

I'm a technology professional who's been passionate about computers since my Grandad introduced me to an Intel 386 back in the 90s when I was a kid. Those moments inspired a passion within for technology, and I've been playing around with anything with a circuit board ever since. Whenever I have a moment you can probably find me working on something computer-related, and this is where I like to write about those moments.