$ sudo apt-get update && sudo apt-get upgrade
first to bring everything up to date.
Fairly simple, just do:
$ sudo apt-get install python-dev libxslt1-dev libxml2-dev libffi-dev libssl-dev
mitmproxy requires pyasn library >= 0.1.8.
(As of this writing, the latest in the repo is 0.1.7)
Check your installed version:
$ dpkg -l | grep pyasn
ii python-pyasn1 0.1.7-1 (...)
If the version is >= 0.1.8 you're fine. If, like above, it's version 0.1.7 then you'll need to replace it with a newer version. The pip repo contains 0.1.9, so I used that.
$ sudo apt-get remove python-pyasn1
$ sudo pip install pyasn1
If all the above went well, you should now be able to download, compile, and install mitmproxy (and its included dependencies) using pip. (Note: This will take 30+ minutes on a standard RaspPi B)
$ sudo pip install mitmproxy
If all goes well, you should now be able to run mitmproxy.