環境: Mac OS X 10.9.4python
1. 安裝xcode
直接用pip 安裝app
pip install mitmproxy
發如今安裝依賴包 lxml 的時候報錯ui
In file included from src/lxml/lxml.etree.c:239: /private/tmp/pip_build_root/lxml/src/lxml/includes/etree_defs.h:14:10: fatal error: 'libxml/xmlversion.h' file not found #include "libxml/xmlversion.h" ^ 1 error generated. error: command 'cc' failed with exit status 1
參考網上解決辦法 spa
launchctl load -w /System/Library/LaunchDaemons/com.apple.locate.plist
sh-3.2# locate xmlversion.h /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/libxml2/libxml/xmlversion.h /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/libxml2/libxml/xmlversion.h /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/usr/include/libxml2/libxml/xmlversion.h /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk/usr/include/libxml2/libxml/xmlversion.h
ln -s /usr/include/libxml2 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk/usr/include/libxml2/libxml
從新編譯,發現仍是不行code
執行以下命令orm
xcode-select --install
能夠正常安裝了xml
2. 使用blog
安裝完畢後,會在 /usr/local/bin 目錄下生成 mitmproxy mitmdump 2個命令ip
嘗試執行下
sh-3.2# /usr/local/bin/mitmproxy You are using an outdated version of pyOpenSSL: mitmproxy requires pyOpenSSL 0.14 or greater. Your pyOpenSSL 0.13 installation is located at /System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/OpenSSL
發現 pyOpenSSL 0.14 版本
上pypi.python.org 找下 ,下載源碼並安裝
wget https://pypi.python.org/packages/source/p/pyOpenSSL/pyOpenSSL-0.14.tar.gz#md5=8579ff3a1d858858acfba5f046a4ddf7 tar zxvf pyOpenSSL-0.14.tar.gz cd pyOpenSSL-0.14 python setup.py install
在執行下 /usr/local/bin/mitmproxy ,成功