I'm trying to delete an application password. I'm using the security delete-generic-password command. When I execute it via terminal, everything works fine – it does delete the password.
When I include the same command in a shell script, and then execute it via Xcode, it does not delete the password. I guess the problem is that the security command can't get the root password.
I'm deleting it in an uninstaller, so before I execute anything, I'm asking for the root password. After that, I'm calling this script through the Xcode project. Since I already have the root password, I execute command with sudo as follows:
sudo security delete-generic-password password_name "/Library/Keychains/System.keychain"
I hope sudo does get the root password internally, as I'm already authenticating before executing anything in my uninstaller.