Building mpl on OSX is sometimes a nightmare because of all the
different types of zlib, png and freetype that may be on your system.

For developers who want to build matplotlib from source, the recommended and 
supported way to build is to use a third-party package manager to install the 
required dependencies, and then install matplotlib from source using the 
setup.py script. Two widely used package managers are homebrew, and 
MacPorts. The following example illustrates how to install libpng and freetype 
using brew:

Example usage::

  brew install libpng freetype pkgconfig

If you are using MacPorts, execute the following instead:

Example usage::

  port install libpng freetype

To install matplotlib from source, execute:

Example usage::

  python setup.py install


Note that your environment is somewhat important. Some conda users have 
found that, to run the tests, their PYTHONPATH must include 
/path/to/anaconda/.../site-packages and their DYLD_FALLBACK_LIBRARY_PATH 
must include /path/to/anaconda/lib.
