mac screenshot crontab only got desktop
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
- close SIP.
restart Mac and hold down cmd+r into recovery mode, open terminal input csrutil disable
, restart again
- grant write permission to TCC
sudo chmod 664 /Library/Application\ Support/com.apple.TCC
- 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,"")'
- Re-enable SIP
restart Mac and hold down cmd+r into recovery mode, open terminal input csrutil enable
, restart again