Where should I put cron jobs?

I have some shell code that I'd like to execute daily using cron. Currently, I have the entire code written as a one-liner, and the 6 variations (each designed to run at different times) are all written in the crontab. While this works, it's quite difficult to read, and could be made more efficient by putting the code in a shell script, and running the script with cron.

However, I need to put the script somewhere. I cannot find anything in the man pages or online specifying the 'proper' location for cron jobs. Is there a directory in /etc for cron jobs? Or should I use root permissions to put my script in /usr/lib/cron/jobs/? Should I put the script in ~/.bin/ and use the full path in my crontab?

When I ask where I 'should' put it, I am looking for the location that is designated by the implementation of cron, or, if the doesn't exist, the location that makes the most sense and is most secure.


Both /etc and /usr are part of macOS and get mostly overwritten with each OS upgrade (with the exception of /usr/local). So you don‘t want to store your own content there.

The canonical place for user-provided code is /usr/local/bin, at least if you don‘t mind other users reading the shell script or running it. Otherwise (or to make it easier to update it) ~/.bin or similar is a good place.