Numerous errors installing on OS X

Hello,
I attempted to install mitmproxy on Mac OS X 10.11.6 using command line: pip install mitmproxy

A notice a number of errors were reported, and the final result is that it was not installed. I would appreciate some assistance figuring out what went wrong and, ideally, to get it installed, OR to at least remove the many files it introduced to my computer. I might then see if I have better luck installed with Homebrew.

The errors:

1 error generated.
  Compile failed: command 'clang' failed with exit status 1

and

Command "/usr/local/opt/python/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/d3/tp3xly2j00s5ztd9rbskg0hm0000gp/T/pip-build-iDAx_m/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/d3/tp3xly2j00s5ztd9rbskg0hm0000gp/T/pip-lNIR1J-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/d3/tp3xly2j00s5ztd9rbskg0hm0000gp/T/pip-build-iDAx_m/lxml/

Here is a record of the attempted install:

j-mbp:development jonathan$ pip install tamper
Collecting tamper
  Downloading tamper-0.24.5.tar.gz
Collecting gevent-websocket>=0.9.3 (from tamper)
  Downloading gevent-websocket-0.9.5.tar.gz
Collecting mitmproxy==0.11.1 (from tamper)
  Downloading mitmproxy-0.11.1.tar.gz (6.3MB)
    100% |████████████████████████████████| 6.3MB 101kB/s
Collecting gevent (from gevent-websocket>=0.9.3->tamper)
  Downloading gevent-1.1.2-cp27-cp27m-macosx_10_6_intel.whl (762kB)
    100% |████████████████████████████████| 768kB 324kB/s
Collecting Flask>=0.10.1 (from mitmproxy==0.11.1->tamper)
  Downloading Flask-0.11.1-py2.py3-none-any.whl (80kB)
    100% |████████████████████████████████| 81kB 156kB/s
Collecting pyasn1>0.1.2 (from mitmproxy==0.11.1->tamper)
  Downloading pyasn1-0.1.9-py2.py3-none-any.whl
Collecting tornado>=4.0.2 (from mitmproxy==0.11.1->tamper)
  Downloading tornado-4.4.2.tar.gz (460kB)
    100% |████████████████████████████████| 460kB 271kB/s
Collecting urwid>=1.1 (from mitmproxy==0.11.1->tamper)
  Downloading urwid-1.3.1.tar.gz (588kB)
    100% |████████████████████████████████| 593kB 106kB/s
Collecting sortedcontainers>=0.9.1 (from mitmproxy==0.11.1->tamper)
  Downloading sortedcontainers-1.5.4-py2.py3-none-any.whl
Collecting pyOpenSSL>=0.14 (from mitmproxy==0.11.1->tamper)
  Downloading pyOpenSSL-16.2.0-py2.py3-none-any.whl (43kB)
    100% |████████████████████████████████| 51kB 64kB/s
Collecting Pillow>=2.3.0 (from mitmproxy==0.11.1->tamper)
  Downloading Pillow-3.4.2.tar.gz (10.8MB)
    100% |████████████████████████████████| 10.8MB 35kB/s
Collecting netlib<0.12,>=0.11 (from mitmproxy==0.11.1->tamper)
  Downloading netlib-0.11.2.tar.gz (43kB)
    100% |████████████████████████████████| 51kB 66kB/s
Collecting lxml>=3.3.6 (from mitmproxy==0.11.1->tamper)
  Downloading lxml-3.6.4.tar.gz (3.7MB)
    100% |████████████████████████████████| 3.7MB 109kB/s
Collecting greenlet>=0.4.9 (from gevent->gevent-websocket>=0.9.3->tamper)
  Downloading greenlet-0.4.10.zip (82kB)
    100% |████████████████████████████████| 92kB 86kB/s
Collecting itsdangerous>=0.21 (from Flask>=0.10.1->mitmproxy==0.11.1->tamper)
  Downloading itsdangerous-0.24.tar.gz (46kB)
    100% |████████████████████████████████| 51kB 108kB/s
Collecting Jinja2>=2.4 (from Flask>=0.10.1->mitmproxy==0.11.1->tamper)
  Downloading Jinja2-2.8-py2.py3-none-any.whl (263kB)
    100% |████████████████████████████████| 266kB 174kB/s
Collecting Werkzeug>=0.7 (from Flask>=0.10.1->mitmproxy==0.11.1->tamper)
  Downloading Werkzeug-0.11.11-py2.py3-none-any.whl (306kB)
    100% |████████████████████████████████| 307kB 2.8MB/s
Collecting click>=2.0 (from Flask>=0.10.1->mitmproxy==0.11.1->tamper)
  Downloading click-6.6.tar.gz (283kB)
    100% |████████████████████████████████| 286kB 163kB/s
Collecting singledispatch (from tornado>=4.0.2->mitmproxy==0.11.1->tamper)
  Downloading singledispatch-3.4.0.3-py2.py3-none-any.whl
Collecting certifi (from tornado>=4.0.2->mitmproxy==0.11.1->tamper)
  Downloading certifi-2016.9.26-py2.py3-none-any.whl (377kB)
    100% |████████████████████████████████| 378kB 147kB/s
Collecting backports_abc>=0.4 (from tornado>=4.0.2->mitmproxy==0.11.1->tamper)
  Downloading backports_abc-0.4-py2.py3-none-any.whl
Collecting cryptography>=1.3.4 (from pyOpenSSL>=0.14->mitmproxy==0.11.1->tamper)
  Downloading cryptography-1.5.2-cp27-cp27m-macosx_10_10_intel.whl (2.4MB)
    100% |████████████████████████████████| 2.4MB 128kB/s
Collecting six>=1.5.2 (from pyOpenSSL>=0.14->mitmproxy==0.11.1->tamper)
  Downloading six-1.10.0-py2.py3-none-any.whl
Collecting passlib>=1.6.2 (from netlib<0.12,>=0.11->mitmproxy==0.11.1->tamper)
  Downloading passlib-1.6.5-py2.py3-none-any.whl (317kB)
    100% |████████████████████████████████| 327kB 160kB/s
Collecting MarkupSafe (from Jinja2>=2.4->Flask>=0.10.1->mitmproxy==0.11.1->tamper)
  Downloading MarkupSafe-0.23.tar.gz
Collecting cffi>=1.4.1 (from cryptography>=1.3.4->pyOpenSSL>=0.14->mitmproxy==0.11.1->tamper)
  Downloading cffi-1.8.3-cp27-cp27m-macosx_10_10_intel.whl (213kB)
    100% |████████████████████████████████| 215kB 235kB/s
Collecting ipaddress (from cryptography>=1.3.4->pyOpenSSL>=0.14->mitmproxy==0.11.1->tamper)
  Downloading ipaddress-1.0.17-py2-none-any.whl
Requirement already satisfied (use --upgrade to upgrade): setuptools>=11.3 in /usr/local/lib/python2.7/site-packages (from cryptography>=1.3.4->pyOpenSSL>=0.14->mitmproxy==0.11.1->tamper)
Collecting enum34 (from cryptography>=1.3.4->pyOpenSSL>=0.14->mitmproxy==0.11.1->tamper)
  Downloading enum34-1.1.6-py2-none-any.whl
Collecting idna>=2.0 (from cryptography>=1.3.4->pyOpenSSL>=0.14->mitmproxy==0.11.1->tamper)
  Downloading idna-2.1-py2.py3-none-any.whl (54kB)
    100% |████████████████████████████████| 61kB 465kB/s
Collecting pycparser (from cffi>=1.4.1->cryptography>=1.3.4->pyOpenSSL>=0.14->mitmproxy==0.11.1->tamper)
  Downloading pycparser-2.16.tar.gz (230kB)
    100% |████████████████████████████████| 235kB 2.1MB/s
Building wheels for collected packages: tamper, gevent-websocket, mitmproxy, tornado, urwid, Pillow, netlib, lxml, greenlet, itsdangerous, click, MarkupSafe, pycparser
  Running setup.py bdist_wheel for tamper ... done
  Stored in directory: /Users/jonathan/Library/Caches/pip/wheels/f9/e3/1e/060ed30d618906aad76cdf55a59d9c689d19527457f57dd290
  Running setup.py bdist_wheel for gevent-websocket ... done
  Stored in directory: /Users/jonathan/Library/Caches/pip/wheels/d8/34/b8/cdbfc642f5351911099477cbea15e0a0c6db72117b7c7f312c
  Running setup.py bdist_wheel for mitmproxy ... done
  Stored in directory: /Users/jonathan/Library/Caches/pip/wheels/d3/f6/76/ce956ed106af673d924af369c3950a9f9fcf065a3264e85f8c
  Running setup.py bdist_wheel for tornado ... done
  Stored in directory: /Users/jonathan/Library/Caches/pip/wheels/b3/db/47/46e05d1ee3ecfba252fcab42f0a156dab0df0cddf99fa0827c
  Running setup.py bdist_wheel for urwid ... done
  Stored in directory: /Users/jonathan/Library/Caches/pip/wheels/e7/bb/9d/d7f7fcc9b3aeae20cf4685667635002415629e6395ff2dda7d
  Running setup.py bdist_wheel for Pillow ... done
  Stored in directory: /Users/jonathan/Library/Caches/pip/wheels/ab/45/85/9b41e83291b8c35d587a2d34a32132a0299b9b8cf6ea75a40b
  Running setup.py bdist_wheel for netlib ... done
  Stored in directory: /Users/jonathan/Library/Caches/pip/wheels/f2/07/c4/e35a82ae8ed17d04c8c0ca44b99a80dd547aff0296993d8646
  Running setup.py bdist_wheel for lxml ... error
  Complete output from command /usr/local/opt/python/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/d3/tp3xly2j00s5ztd9rbskg0hm0000gp/T/pip-build-iDAx_m/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" bdist_wheel -d /var/folders/d3/tp3xly2j00s5ztd9rbskg0hm0000gp/T/tmpBfiw3ypip-wheel- --python-tag cp27:
  Building lxml version 3.6.4.
  Building without Cython.
  Using build configuration of libxslt 1.1.28
  Building against libxml2/libxslt in the following directory: /Applications/MAMP/Library/lib
  running bdist_wheel
  running build
  running build_py
  creating build
  creating build/lib.macosx-10.10-x86_64-2.7
  creating build/lib.macosx-10.10-x86_64-2.7/lxml
  copying src/lxml/__init__.py -> build/lib.macosx-10.10-x86_64-2.7/lxml
  copying src/lxml/_elementpath.py -> build/lib.macosx-10.10-x86_64-2.7/lxml
  copying src/lxml/builder.py -> build/lib.macosx-10.10-x86_64-2.7/lxml
  copying src/lxml/cssselect.py -> build/lib.macosx-10.10-x86_64-2.7/lxml
  copying src/lxml/doctestcompare.py -> build/lib.macosx-10.10-x86_64-2.7/lxml
  copying src/lxml/ElementInclude.py -> build/lib.macosx-10.10-x86_64-2.7/lxml
  copying src/lxml/pyclasslookup.py -> build/lib.macosx-10.10-x86_64-2.7/lxml
  copying src/lxml/sax.py -> build/lib.macosx-10.10-x86_64-2.7/lxml
  copying src/lxml/usedoctest.py -> build/lib.macosx-10.10-x86_64-2.7/lxml
  creating build/lib.macosx-10.10-x86_64-2.7/lxml/includes
  copying src/lxml/includes/__init__.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
  creating build/lib.macosx-10.10-x86_64-2.7/lxml/html
  copying src/lxml/html/__init__.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/html
  copying src/lxml/html/_diffcommand.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/html
  copying src/lxml/html/_html5builder.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/html
  copying src/lxml/html/_setmixin.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/html
  copying src/lxml/html/builder.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/html
  copying src/lxml/html/clean.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/html
  copying src/lxml/html/defs.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/html
  copying src/lxml/html/diff.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/html
  copying src/lxml/html/ElementSoup.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/html
  copying src/lxml/html/formfill.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/html
  copying src/lxml/html/html5parser.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/html
  copying src/lxml/html/soupparser.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/html
  copying src/lxml/html/usedoctest.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/html
  creating build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron
  copying src/lxml/isoschematron/__init__.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron
  copying src/lxml/lxml.etree.h -> build/lib.macosx-10.10-x86_64-2.7/lxml
  copying src/lxml/lxml.etree_api.h -> build/lib.macosx-10.10-x86_64-2.7/lxml
  copying src/lxml/includes/c14n.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
  copying src/lxml/includes/config.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
  copying src/lxml/includes/dtdvalid.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
  copying src/lxml/includes/etreepublic.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
  copying src/lxml/includes/htmlparser.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
  copying src/lxml/includes/relaxng.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
  copying src/lxml/includes/schematron.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
  copying src/lxml/includes/tree.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
  copying src/lxml/includes/uri.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
  copying src/lxml/includes/xinclude.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
  copying src/lxml/includes/xmlerror.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
  copying src/lxml/includes/xmlparser.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
  copying src/lxml/includes/xmlschema.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
  copying src/lxml/includes/xpath.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
  copying src/lxml/includes/xslt.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
  copying src/lxml/includes/etree_defs.h -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
  copying src/lxml/includes/lxml-version.h -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
  creating build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron/resources
  creating build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron/resources/rng
  copying src/lxml/isoschematron/resources/rng/iso-schematron.rng -> build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron/resources/rng
  creating build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron/resources/xsl
  copying src/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl -> build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron/resources/xsl
  copying src/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl -> build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron/resources/xsl
  creating build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl -> build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl -> build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl -> build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl -> build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl -> build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt -> build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
  running build_ext
  building 'lxml.etree' extension
  creating build/temp.macosx-10.10-x86_64-2.7
  creating build/temp.macosx-10.10-x86_64-2.7/src
  creating build/temp.macosx-10.10-x86_64-2.7/src/lxml
  clang -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Applications/MAMP/Library/include -I/Applications/MAMP/Library/include/libxml2 -Isrc/lxml/includes -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.macosx-10.10-x86_64-2.7/src/lxml/lxml.etree.o -w -flat_namespace
  In file included from src/lxml/lxml.etree.c:321:
  src/lxml/includes/etree_defs.h:14:10: fatal error: 'libxml/xmlversion.h' file not found
  #include "libxml/xmlversion.h"
           ^
  1 error generated.
  Compile failed: command 'clang' failed with exit status 1
  creating var
  creating var/folders
  creating var/folders/d3
  creating var/folders/d3/tp3xly2j00s5ztd9rbskg0hm0000gp
  creating var/folders/d3/tp3xly2j00s5ztd9rbskg0hm0000gp/T
  cc -I/Applications/MAMP/Library/include -I/Applications/MAMP/Library/include/libxml2 -I/usr/include/libxml2 -c /var/folders/d3/tp3xly2j00s5ztd9rbskg0hm0000gp/T/xmlXPathInitWCC1Px.c -o var/folders/d3/tp3xly2j00s5ztd9rbskg0hm0000gp/T/xmlXPathInitWCC1Px.o
  /var/folders/d3/tp3xly2j00s5ztd9rbskg0hm0000gp/T/xmlXPathInitWCC1Px.c:2:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
  main (int argc, char **argv) {
  ^
  1 warning generated.
  cc var/folders/d3/tp3xly2j00s5ztd9rbskg0hm0000gp/T/xmlXPathInitWCC1Px.o -L/Applications/MAMP/Library/lib -lxml2 -o a.out
  error: command 'clang' failed with exit status 1

  ----------------------------------------
  Failed building wheel for lxml
  Running setup.py clean for lxml
  Running setup.py bdist_wheel for greenlet ... done
  Stored in directory: /Users/jonathan/Library/Caches/pip/wheels/e0/f2/33/6e4a562e7497e9393110f64fee640f5bc9eefdd82c02b035b1
  Running setup.py bdist_wheel for itsdangerous ... done
  Stored in directory: /Users/jonathan/Library/Caches/pip/wheels/fc/a8/66/24d655233c757e178d45dea2de22a04c6d92766abfb741129a
  Running setup.py bdist_wheel for click ... done
  Stored in directory: /Users/jonathan/Library/Caches/pip/wheels/b0/6d/8c/cf5ca1146e48bc7914748bfb1dbf3a40a440b8b4f4f0d952dd
  Running setup.py bdist_wheel for MarkupSafe ... done
  Stored in directory: /Users/jonathan/Library/Caches/pip/wheels/a3/fa/dc/0198eed9ad95489b8a4f45d14dd5d2aee3f8984e46862c5748
  Running setup.py bdist_wheel for pycparser ... done
  Stored in directory: /Users/jonathan/Library/Caches/pip/wheels/34/cc/b5/34e805b130a9227f0681d5517cf554d950bb0361c3a373496f
Successfully built tamper gevent-websocket mitmproxy tornado urwid Pillow netlib greenlet itsdangerous click MarkupSafe pycparser
Failed to build lxml
Installing collected packages: greenlet, gevent, gevent-websocket, itsdangerous, MarkupSafe, Jinja2, Werkzeug, click, Flask, pyasn1, six, singledispatch, certifi, backports-abc, tornado, urwid, sortedcontainers, pycparser, cffi, ipaddress, enum34, idna, cryptography, pyOpenSSL, Pillow, passlib, netlib, lxml, mitmproxy, tamper
  Running setup.py install for lxml ... error
    Complete output from command /usr/local/opt/python/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/d3/tp3xly2j00s5ztd9rbskg0hm0000gp/T/pip-build-iDAx_m/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/d3/tp3xly2j00s5ztd9rbskg0hm0000gp/T/pip-lNIR1J-record/install-record.txt --single-version-externally-managed --compile:
    Building lxml version 3.6.4.
    Building without Cython.
    Using build configuration of libxslt 1.1.28
    Building against libxml2/libxslt in the following directory: /Applications/MAMP/Library/lib
    running install
    running build
    running build_py
    creating build
    creating build/lib.macosx-10.10-x86_64-2.7
    creating build/lib.macosx-10.10-x86_64-2.7/lxml
    copying src/lxml/__init__.py -> build/lib.macosx-10.10-x86_64-2.7/lxml
    copying src/lxml/_elementpath.py -> build/lib.macosx-10.10-x86_64-2.7/lxml
    copying src/lxml/builder.py -> build/lib.macosx-10.10-x86_64-2.7/lxml
    copying src/lxml/cssselect.py -> build/lib.macosx-10.10-x86_64-2.7/lxml
    copying src/lxml/doctestcompare.py -> build/lib.macosx-10.10-x86_64-2.7/lxml
    copying src/lxml/ElementInclude.py -> build/lib.macosx-10.10-x86_64-2.7/lxml
    copying src/lxml/pyclasslookup.py -> build/lib.macosx-10.10-x86_64-2.7/lxml
    copying src/lxml/sax.py -> build/lib.macosx-10.10-x86_64-2.7/lxml
    copying src/lxml/usedoctest.py -> build/lib.macosx-10.10-x86_64-2.7/lxml
    creating build/lib.macosx-10.10-x86_64-2.7/lxml/includes
    copying src/lxml/includes/__init__.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
    creating build/lib.macosx-10.10-x86_64-2.7/lxml/html
    copying src/lxml/html/__init__.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/html
    copying src/lxml/html/_diffcommand.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/html
    copying src/lxml/html/_html5builder.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/html
    copying src/lxml/html/_setmixin.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/html
    copying src/lxml/html/builder.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/html
    copying src/lxml/html/clean.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/html
    copying src/lxml/html/defs.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/html
    copying src/lxml/html/diff.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/html
    copying src/lxml/html/ElementSoup.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/html
    copying src/lxml/html/formfill.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/html
    copying src/lxml/html/html5parser.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/html
    copying src/lxml/html/soupparser.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/html
    copying src/lxml/html/usedoctest.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/html
    creating build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron
    copying src/lxml/isoschematron/__init__.py -> build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron
    copying src/lxml/lxml.etree.h -> build/lib.macosx-10.10-x86_64-2.7/lxml
    copying src/lxml/lxml.etree_api.h -> build/lib.macosx-10.10-x86_64-2.7/lxml
    copying src/lxml/includes/c14n.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
    copying src/lxml/includes/config.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
    copying src/lxml/includes/dtdvalid.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
    copying src/lxml/includes/etreepublic.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
    copying src/lxml/includes/htmlparser.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
    copying src/lxml/includes/relaxng.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
    copying src/lxml/includes/schematron.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
    copying src/lxml/includes/tree.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
    copying src/lxml/includes/uri.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
    copying src/lxml/includes/xinclude.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
    copying src/lxml/includes/xmlerror.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
    copying src/lxml/includes/xmlparser.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
    copying src/lxml/includes/xmlschema.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
    copying src/lxml/includes/xpath.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
    copying src/lxml/includes/xslt.pxd -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
    copying src/lxml/includes/etree_defs.h -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
    copying src/lxml/includes/lxml-version.h -> build/lib.macosx-10.10-x86_64-2.7/lxml/includes
    creating build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron/resources
    creating build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron/resources/rng
    copying src/lxml/isoschematron/resources/rng/iso-schematron.rng -> build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron/resources/rng
    creating build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron/resources/xsl
    copying src/lxml/isoschematron/resources/xsl/RNG2Schtrn.xsl -> build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron/resources/xsl
    copying src/lxml/isoschematron/resources/xsl/XSD2Schtrn.xsl -> build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron/resources/xsl
    creating build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
    copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_abstract_expand.xsl -> build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
    copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_dsdl_include.xsl -> build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
    copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_message.xsl -> build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
    copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_schematron_skeleton_for_xslt1.xsl -> build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
    copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/iso_svrl_for_xslt1.xsl -> build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
    copying src/lxml/isoschematron/resources/xsl/iso-schematron-xslt1/readme.txt -> build/lib.macosx-10.10-x86_64-2.7/lxml/isoschematron/resources/xsl/iso-schematron-xslt1
    running build_ext
    building 'lxml.etree' extension
    creating build/temp.macosx-10.10-x86_64-2.7
    creating build/temp.macosx-10.10-x86_64-2.7/src
    creating build/temp.macosx-10.10-x86_64-2.7/src/lxml
    clang -fno-strict-aliasing -fno-common -dynamic -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Applications/MAMP/Library/include -I/Applications/MAMP/Library/include/libxml2 -Isrc/lxml/includes -I/usr/local/include -I/usr/local/opt/openssl/include -I/usr/local/opt/sqlite/include -I/usr/local/Cellar/python/2.7.12/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c src/lxml/lxml.etree.c -o build/temp.macosx-10.10-x86_64-2.7/src/lxml/lxml.etree.o -w -flat_namespace
    In file included from src/lxml/lxml.etree.c:321:
    src/lxml/includes/etree_defs.h:14:10: fatal error: 'libxml/xmlversion.h' file not found
    #include "libxml/xmlversion.h"
             ^
    1 error generated.
    Compile failed: command 'clang' failed with exit status 1
    cc -I/Applications/MAMP/Library/include -I/Applications/MAMP/Library/include/libxml2 -I/usr/include/libxml2 -c /var/folders/d3/tp3xly2j00s5ztd9rbskg0hm0000gp/T/xmlXPathInitjkWCCq.c -o var/folders/d3/tp3xly2j00s5ztd9rbskg0hm0000gp/T/xmlXPathInitjkWCCq.o
    /var/folders/d3/tp3xly2j00s5ztd9rbskg0hm0000gp/T/xmlXPathInitjkWCCq.c:2:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
    main (int argc, char **argv) {
    ^
    1 warning generated.
    cc var/folders/d3/tp3xly2j00s5ztd9rbskg0hm0000gp/T/xmlXPathInitjkWCCq.o -L/Applications/MAMP/Library/lib -lxml2 -o a.out
    error: command 'clang' failed with exit status 1

    ----------------------------------------
Command "/usr/local/opt/python/bin/python2.7 -u -c "import setuptools, tokenize;__file__='/private/var/folders/d3/tp3xly2j00s5ztd9rbskg0hm0000gp/T/pip-build-iDAx_m/lxml/setup.py';exec(compile(getattr(tokenize, 'open', open)(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --record /var/folders/d3/tp3xly2j00s5ztd9rbskg0hm0000gp/T/pip-lNIR1J-record/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /private/var/folders/d3/tp3xly2j00s5ztd9rbskg0hm0000gp/T/pip-build-iDAx_m/lxml/

This looks pip fails to install lxml because libxml is not installed on your system. One of the following should help:


http://docs.mitmproxy.org/en/stable/install.html#installation-from-source-mac-os-x