I have a program that needs to run every day and is written in Rust. My program works perfectly when I run it in the terminal, but when running it using cron
it gives an error. After a lot of searching I located the problem. My program needs to run the security unix executable (/usr/bin/security
on macOS), specifically the find-generic-password
command. When cron
runs my program it doesn’t find the correct password and it returns the error:
"security: SecKeychainSearchCopyNext: The specified item could not be found in the keychain.n"
It does find the correct value when I run my script using terminal.
I presume this has something to do with how cron
runs the script and which user is active but is there a way to fix this error?