Problem with cron which run python script for detecting position of mouse.

I have python script with detecting if the mouse is moving.


If the script is run from terminal like "sudo su" it work correctly.

But if the same scrip is run from crontab I get msg "This process is not trusted! Input event monitoring will not be possible until it is added to accessibility clients."


cron and terminal are added to "Privacy & Security > Accessibility" and "Privacy & Security > Input Monitoring"


It worked in previous OS but in MacOS 14.2.1 it doesnt work.





Mac mini, macOS 14.2

Posted on Dec 30, 2023 1:05 PM

Reply
3 replies

Dec 30, 2023 1:55 PM in response to vosy

When using cron, make sure that cron has permissions:


Cron needs full disk access and automation to run certain things in the background.


Full Disk Access:


Go to "System Preferences" on your macOS.
Select "Security & Privacy."
Go to the "Privacy" tab.
In the left sidebar, select "Full Disk Access."
Click the lock icon in the lower-left corner to make changes and enter your administrator password.
Drag your terminal application or the script interpreter into the list to grant it full disk access.


Automation:


Look for "Automation" in the left sidebar.
Check if your terminal or script interpreter is listed and has access to the necessary applications or services.


I had this trouble a while back with using cron. Once I put cron in those two boxes, my cronjob started working. There are other things within the privacy and security tab to be tweaked, but that depends on what your script does and requires.


I hope this helps you out.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Problem with cron which run python script for detecting position of mouse.

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.