MacOS – How to schedule run of .command file (bash)

bashcalendarmacosterminal

I have a bash script (saved as myfilename.command) and would like to schedule its run. I've tried to use Calendar event for this (which works fine with Automator scripts), but I get the following error –

“myfilename.command” can’t be opened because CoreServicesUIAgent is
not allowed to open documents in Terminal.

Is there any way to fix it?

Best Answer

There are several ways and I think the first step is to make the .command file just a shell script.

Given you comment re automator I would suggest the easiest way is to create an automator/applescript that calls this shell script. This then can be called by calendar

Other ways are using non GUI tools and call the shell script from a cron or launchd entry