Add Python Application to accept incoming network connections


While running Django webserver, I get a popup window that says –
Do you want the application "python" to accept incoming network connections?
I always click "Allow" and I can see in my Security & Privacy settings that "python" is there and is set to "Allow incoming connections," but I still get this popup. How can I prevent this popup from reappearing?


Asked By: Jim



You can resolve this by signing the offending application binary yourself.

Disclaimer: Signing an application yourself will make an application appear more
secure to the operating system, when in reality it isn’t. Only sign applications
that you are 100% sure are not spyware or otherwise malicious. If you have any
doubts, just uninstall/reinstall.

Part 1: Create a Signing Identity

The solution I’m going for – signing the app myself – requires that I create a Signing Identity, also known as Signing Certificate. This is very easy to do:

  1. Open Applications > Utilities > Keychain Access.
  2. From the Keychain Access menu, choose Certificate Assistant > Create a Certificate.
  3. Fill in a name for the certificate. This name appears in the Keychain Access utility as the name of the certificate. This is also the name you will use when referencing this certificate. Personally, I used the name, “My Signing Identity.”
  4. Choose Code Signing from the Certificate Type menu.
  5. Choose Self Signed Root from the Type popup menu.
  6. Check the Let me override defaults checkbox.
  7. Click Continue.
  8. Specify a serial number for the certificate. Any number will do as long as you have no other certificate with the same name and serial number.
  9. Click Continue.
  10. Fill in the information for the certificate. You can use real or fake data, I used real data personally.
  11. Click Continue.
  12. Accept the defaults for the rest of the dialogs.

Once completed, you will see your certificate in Keychain Access. Verify the name you picked, and you’re done with this step. Well done!

Step 2: (Re-)Sign your application

Now you have to sign your application. To do this, open up Terminal again and use the following command:

codesign -s "My Signing Identity" -f $(which python)

A dialog will appear, click “Allow”.

Now start your application again. You will get the accept incoming connections dialog one last time. Click “Allow”.

enter image description here

From now on you should no longer get the warnings anymore! Now it is possible to enjoy the security of your firewall being active without the inconvenience of having to click “allow” constantly.

Credit: The original source which served as a starting place for this updated and annotated solution guide was

Answered By: Jay Taylor
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.