OS X / How to allow python to accept incoming network connections

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:
  1. Open Keychain Access (Applications > Utilities > Keychain Access)
  2. Keychain Access menu > Certificate Assistant > Create a Certificate...
  3. Enter a Name like "My Certificate".
  4. Select Identity Type: Self Signed Root
  5. Select Certificate Type: Code Signing
  6. Check the Let me override defaults box
  7. Click Continue
  8. Enter a unique Serial Number
  9. Enter 3600 for Validity Period.
  10. Click Continue
  11. Click Continue for the rest of the dialogs

Now sign your application
codesign -f -s "Certificate name" venv/bin/python

In the dialog that appears, click "Allow".
Note that when using a virtual environment, you'll need to activate the virtual environment before running the command:
$ source venv/bin/activate

No comments:

Post a Comment