mitmproxyをmacOS High Sierraにインストール

イカリング2をPCブラウザで見れる方法があるらしいのでやってみた – Qiita

High SierraにはデフォルトでPython2.6が入っているけどmitmproxyはPython3以上が必要みたい。
・Python 3.6.3をインストール

$ brew install pyenv
$ vi ~/.bash_profile
export PYENV_ROOT="$HOME/.pyenv"
export PATH="$PYENV_ROOT/bin:$PATH"
eval "$(pyenv init -)"
$ xcode-select --install
これをしないと zipimport.ZipImportError: can't decompress data; zlib not available というエラーが出てpythonのインストールに失敗しました
$ pyenv install 3.6.3
$ pyenv versions
* system (set by /Users/yusuke/.pyenv/version)
$ pyenv global 3.6.3
$ pyenv rehash
$ pyenv versions
* 3.6.3 (set by /Users/yusuke/.pyenv/version)
$ easy_install pip
Searching for pip
Best match: pip 9.0.1
Adding pip 9.0.1 to easy-install.pth file
Installing pip script to /Users/yusuke/.pyenv/versions/3.6.3/bin
Installing pip3 script to /Users/yusuke/.pyenv/versions/3.6.3/bin
Installing pip3.5 script to /Users/yusuke/.pyenv/versions/3.6.3/bin

Using /Users/yusuke/.pyenv/versions/3.6.3/lib/python3.6/site-packages
Processing dependencies for pip
Finished processing dependencies for pip

$ pip list
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
pip (9.0.1)
setuptools (28.8.0)

$ pip install mitmproxy
Collecting mitmproxy
Downloading mitmproxy-2.0.2-py3-none-any.whl (1.4MB)
100% |████████████████████████████████| 1.4MB 1.0MB/s
Collecting tornado<4.5,>=4.3 (from mitmproxy)
Downloading tornado-4.4.3.tar.gz (463kB)
100% |████████████████████████████████| 471kB 2.2MB/s
Collecting watchdog<0.9,>=0.8.3 (from mitmproxy)
Successfully installed PyYAML-3.12 argh-0.26.2 asn1crypto-0.24.0 blinker-1.4 brotlipy-0.6.0 certifi-2017.11.5 cffi-1.11.2 chardet-3.0.4 click-6.7 construct-2.8.17 cryptography-1.8.2 cssutils-1.0.2 editorconfig-0.12.1 h2-2.6.2 hpack-3.0.0 html2text-2016.9.19 hyperframe-4.0.2 idna-2.6 jsbeautifier-1.6.14 kaitaistruct-0.6 mitmproxy-2.0.2 packaging-16.8 passlib-1.7.1 pathtools-0.1.2 pyOpenSSL-16.2.0 pyasn1-0.2.3 pycparser-2.18 pyparsing-2.2.0 pyperclip-1.5.32 requests-2.18.4 ruamel.yaml-0.13.14 six-1.11.0 sortedcontainers-1.5.9 tornado-4.4.3 urllib3-1.22 urwid-1.3.1 watchdog-0.8.3
$ mitmproxy -p 8081

Mac環境へのPython3系インストール – Qiita

Comments are closed.