I am trying to create a crontab to run a script:

* * * * * cd /Users/test3/Desktop/Scripts/backup/ && /bin/zsh test.sh > /tmp/cron-output.log 2>&1

where test.sh is in /Users/test3/Desktop/Scripts/backup and has needed permissions:

-rwxr-xr-x   1 test3  staff   140 May  8 11:34 test.sh

But still I see:

/bin/zsh: can't open input file: test.sh

Manually running script works just fine.

What can be wrong here?


For testing purposes I just have this in test.sh


echo "Hello world"
  • 1
    Have you try to use absolute path? /Users/test3/Desktop/Scripts/backup/test.sh And as you have in script zsh you may just skip it in cron Commented May 8 at 9:56
  • If I use * * * * * /Users/test3/Desktop/Scripts/backup/test.sh > /tmp/cron-output.log 2>&1 the error is this: /bin/zsh: can't open input file: /Users/test3/Desktop/Scripts/backup/test.sh
    – Mihail
    Commented May 8 at 10:56
  • 1
    Is this on macOS? If so: apple.stackexchange.com/a/402179/274760
    – Gairfowl
    Commented May 8 at 11:25
  • Thank you! This solved the issue!
    – Mihail
    Commented May 8 at 13:00

1 Answer 1


Gairfowl’s comment resolved my problem:

Is this on macOS? If so: apple.stackexchange.com/a/402179/274760

Seamus’s answer over on the sister site Ask Different explains that cron must have "Full Disk Access" under the Privacy tab of System Preferences, and provides the graphical detail to get to that pane.

  • 1
    While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - From Review Commented May 8 at 18:03
  • @ChrisDavies: I see your edit and raise you an edit. :-)       P.S. I wonder what macOS is doing by default to prevent Mihail’s processes from accessing Mihail’s files. Commented May 8 at 23:50
  • FWIW, and beyond the "Full Disk Access" business, your crontab entry would be more compactly specified as follows: * * * * * /Users/test3/Desktop/Scripts/backup/test.sh > /tmp/cron-output.log 2>&1. The she-bang in your script eliminates the need for /bin/zsh in the crontab entry, and providing a full path to test.sh is easier than the cd && test.sh business.
    – Seamus
    Commented May 9 at 4:41
  • @G-ManSays'ReinstateMonica' there are similar steps that must be taken to grant the Terminal app (shell CLI) broad access to files too. I assume it's kernel-based enforcement, a bit like SELinux does for Linux-based systems Commented May 9 at 6:49

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .