Last Updated: February 25, 2016
· trenton42

Stop Mac OS X firewall from prompting with Python in virtualenv

Using virtualenv on OS X Mavericks was driving me nuts because the firewall would pop up a prompt every time I ran a script that would listen for incoming network connections. The problem is that virtualenv modifies the python binary when it copies it into the environment, invalidating the signature.


A simple (and temporary, unfortunately) fix is to sign the binary yourself. If you do not have a developer account, you can follow this guide to create a self signed certificate.

Next, run the codesign command line utility to sign the binary with your new certificate. Just be sure to replace Name On Certificate with whatever name you used when you created the certificate in the first step.

$ codesign -f -s "Name On Certificate" venv/bin/python

(Here is where I found the info for signing the python binary)

Say Thanks