Copy file from ~/Library/Safari

I am trying to copy the LastSession.plist file for backup from the ~/Library/Safari folder. I have a launchd daemon that I'm using to make the copy and other backup tasks overnight, however, it gives an error when it tries to copy files from this folder. It works if I run the script from the command line however it doesn't work when executed by launchd. How can I give the script permission to copy from this folder on a schedule?
Answered by kudit in 615416022
I ended up solving this by creating a Mac Swift app and dragging it to the Full Disk Access section of Privacy system preferences. Then I set it up as a Launch Agent instead of a Launch Daemon and this seems to be working now.
Accepted Answer
I ended up solving this by creating a Mac Swift app and dragging it to the Full Disk Access section of Privacy system preferences. Then I set it up as a Launch Agent instead of a Launch Daemon and this seems to be working now.
Copy file from ~/Library/Safari
 
 
Q