23

I have a very simple python script that works when I execute manually. However when I set up a crontab, it finds the script but returns the error "[Errno 1] Operation not permitted".

I tried to set up a root crontab with the command

sudo crontab -e

but the same error occurs.

Here's my crontab:

* */1 * * * /usr/bin/python /absolute_path/test.py > /absolute_path/cron_log_test.log  2>&1

Edit: Everything was working great until I updated to macOS Catalina.

7
  • What are the rights on your file? You can see it with a simple ls -l. Commented Oct 28, 2019 at 15:42
  • Paste ls -l for the Python file here. That will help us understand the file privileges. Commented Oct 28, 2019 at 15:43
  • total 8 -rwxrwxrwx@ 1 john staff 159 28 Oct 16:27 test.py Commented Oct 28, 2019 at 15:47
  • 1
    there is the same topic with solution here: osxdaily.com/2018/10/09/… System Preferences > Security & Privacy and give Full Disk Access to Terminal Commented Oct 28, 2019 at 16:46
  • 2
    I saw that and unfortunately didn't work for me. Commented Oct 28, 2019 at 17:25

1 Answer 1

37

I was able to get my crontab (which calls python) back on track by giving /usr/sbin/cron "Full Disk Access". It's important to note that simple cron jobs were still executing, but my python based jobs were returning "Operation not permitted".

The link that andrea_grioni is on the right track, but aims at giving terminal permission to edit the crontab. This was merely a convince in my case by removing the "allow/deny" dialog. link: Here is a more appropriate link.

Sign up to request clarification or add additional context in comments.

2 Comments

Wow i was stuck on this for hours. The link's instructions are great.
so simple. so difficult to find

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.