Skip to content

Instantly share code, notes, and snippets.

@simonw
Last active October 13, 2021 00:04
Show Gist options
  • Star 19 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save simonw/68d19a46e8edc2cd8c68 to your computer and use it in GitHub Desktop.
Save simonw/68d19a46e8edc2cd8c68 to your computer and use it in GitHub Desktop.
Fix "Do you want the application "python" to accept incoming network connections?" by code signing the python executable in your virtualenv - copied here in case https://www.darklaunch.com/2014/02/02/fix-do-you-want-the-application-python-to-accept-incoming-network-connections ever goes away.
With the OS X firewall enabled, you can remove the "Do you want the application "python" to accept incoming network connections?" message.
Create a self-signed certificate.
Open Keychain Access. Applications > Utilities > Keychain Access.
Keychain Access menu > Certificate Assistant > Create a Certificate...
Enter a Name like "My Certificate".
Select Identity Type: Self Signed Root
Select Certificate Type: Code Signing
Check the Let me override defaults box
Click Continue
Enter a unique Serial Number
Enter 7300 for Validity Period.
Click Continue
Click Continue for the rest of the dialogs
Now sign your application
codesign -s "My Certificate" -f $(which python)
In the dialog that appears, click "Allow".
Note that when using a virtual environment, you need to activate the virtual environment before running this command.
@sfoley-gpqa
Copy link

Does the "Allow" dialog appear when code-signing? This issue is plaguing me and Keychain-related solutions have yet to work for me

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment