Whenever I run codesign
from the command line (or a pre-existing script tries to run it) – e.g. by running codesign -s "Local Developer" foo
the following dialog appears.
Clicking 'Deny' cancels it just fine, but clicking 'Allow' or 'Always Allow' does precisely nothing. The only way to get rid of the dialog is then to click 'Deny', which is of course not what I want. What's going on here? How can I solve this problem?
N.B. There are no messages in the log (via Console.app).
Best Answer
So, the cause of this problem seems to be a change in behaviour of El Capitan regarding virtual events (program-generated user input events), and not allowing them to generate keychain approval. I think the BetterTouchTool program is getting in the way here. The solution is either to disable BetterTouchTool or use the keyboard to click the button.
N.B. Apple have detailed this "fix" in the SecurityAgent section of https://support.apple.com/en-us/HT205375.