0

I aim to use cron to call a python script that changes my desktop background. The key python line is as follows:

from appscript import mactypes, app
app('Finder').desktop_picture.set(mactypes.File(chosen_pic))

When running said script from Terminal, the program runs, but when called by cron, this line gives an error that appears via mail. Experimentation yielded that running from Terminal gives the same error when its permission to edit Finder is unchecked here:

enter image description here

It seems likely that if I could give cron permission to control Finder in this way, that'd solve the problem, but cron's not on this list, and I don't see a way to add it. By contrast, the Full Disk Access pane lets one add new programs, but adding cron doesn't solve this. If it helps, this is on Catalina 10.15.5.

How can one add a new app to the Automation pane here and give it permission to control another app?

Thank you!

  • 1
    Related https://apple.stackexchange.com/questions/372768/on-catalina-how-can-a-cronjob-get-permission-to-touch-files-on-a-usb-disk – nohillside Jul 23 '20 at 06:44
  • Thanks - I've given cron full disk access, but that didn't help. Is it plausible that giving an app permissions under Automation would grant powers that aren't included in Full Disk Access? – dotdashdashdash Jul 23 '20 at 15:04
  • Remember that your cron job is not recognized as your user id when it executes. Also remember its environment differs from yours (thus full paths are often required). You might try setting up a root crontab: i.e. sudo crontab -e, and try running your script from there. Finally, and FWIW, I've largely abandoned cron on my Mac in favor of LaunchControl – Seamus Jul 24 '20 at 00:46
  • @dotdashdashdash it is related, but unfortunately the "Automation" section does not allow to manually add programs, like the "Full disk access" section. Now that one year and half has passed, did you find any way to give Cron that permission? – GeekInDisguise Mar 21 '22 at 03:52
  • 'fraid not! I've just been running the wallpaper-swapping script manually when I want a change of scenery – dotdashdashdash Mar 22 '22 at 00:37

0 Answers0