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).

4 Answers 4


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.


In my case I did not have third party applications interfering with the security restriction. I also could not plug in a mouse or keyboard as I had no physical access to the server. My solution was to:

  1. Remove the private key from the keychain
  2. Re-add the private key, with a flag adding /usr/bin/codesign to the list of exceptions

Here is the command:

sudo security import <exported_file_name>.p12 -k ~/Library/Keychains/login.keychain -T /usr/bin/codesign

  • This saved me. I didn't even have "Always Allow". And after readding the way author described "Always Allow" appeared!
    – Unicorn
    Commented Jul 25, 2022 at 3:38

SmoothMouse, in my case, was causing this. I just had to disable it temporarily to be able to click the Allow button.


Do this from the console. I tried everything in here, and it didn't work. Tried the same thing from the actual device, and it worked the first time.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .