mac screenshot crontab only got desktop

0

I have a little crontab code that takes a screenshot of my mac every 15 mins, as a diary thing to help me with all the administrative works. It has been working fine for a few years now but recently it started only taking the desktop and the status bar at the top, with no applications on the screen, no app docks at the bottom, not even app icons or files on my desktop.

The code works ok if I run it manually in the terminal, but acts up in crontab.

I tried to re-install the crontab but it didnt fix it. And now im out of tricks to fix this.

How do i get crontab to work with screencapture to get the applications on the screen too?

Im running a Mac Catalina Version 10.15.1.

*/15 * * * * /usr/sbin/screencapture -Cxd -tjpg ~/Documents/AutoScreenShot/screen-date +"\%Y\%m\%d-\%H\%M".jpg

Aaron

Posted 2019-12-16T07:01:01.230

Reputation: 101

Answers

1

I had the same problem yesterday afternoon and after hours of trying, I got it. The problem is the cron doesn't have screen access.

Here's the solution

  1. close SIP.

restart Mac and hold down cmd+r into recovery mode, open terminal input csrutil disable, restart again

  1. grant write permission to TCC

sudo chmod 664 /Library/Application\ Support/com.apple.TCC

  1. grant screencapure privilege to cron and screencapture
sudo sqlite3 "/Library/Application Support/com.apple.TCC/TCC.db" 'insert into access values ("kTCCServiceScreenCapture", "/usr/sbin/cron", 1, 1, 1, "", "", "", "UNUSED", "", 0,"")'

sudo sqlite3 "/Library/Application Support/com.apple.TCC/TCC.db" 'insert into access values ("kTCCServiceScreenCapture", "/usr/sbin/screencapture", 1, 1, 1, "", "", "", "UNUSED", "", 0,"")'

big-circle

Posted 2019-12-16T07:01:01.230

Reputation: 111