To build a binary installer for matplotlib that others can use on other versions of MacOS X, use Matthew Brett's build scripts, which as of matplotlib 1.3.1 are the official way to build the binary installer. The following information may possibly also be of some use.
Note: every line that begins with $ is intended to be typed into Terminal (without the leading $; it simply represents the Terminal's prompt).
Install Python from python.org. Using this python will make your matplotlib installer maximally compatible with various versions of Mac OS X.
Install Xcode. You must be a registered developer to download XCode, but registration is free.
Then install the command-line tools using
xcode-select --install (or for older versions of XCode, look in XCode Preferences>Downloads).
$ export MACOSX_DEPLOYMENT_TARGET=10.6
MacOS X with optional XQuartz (X11 on MacOS X 10.7 and earlier) includes all the libraries matplotlib needs. If you are building matplotlib for your own use then simply install XQuartz (or X11). However, if you want to build a binary installer for others to use (and don't want those others to have to install XQuartz or X11) then you must build your own libfreetype and libpng libraries and link those statically. See Matthew Brent's build scripts for details.
Matplotlib requires numpy, preferably using the official binary installer (which, for awhile, were surprisingly hard to find).
maplotlib requires following packages. They can be installed using pip or easy_install or manually from source:
Note: if pip won't install pytz then download the source and install using "python setup.py install". (At the time of this writing there is a known bug that pip can't understand pytz's version numbers).
If you want WXAgg support you must install wxPython. I recommend the most recent stable release (2.8.x at this writing; the 2.9 series is a development branch and is best avoided unless you want to be a beta tester).
Install setuptools. Download it, unpack it and type:
$ python setup.py build $ python setup.py install
Install bdist_mpkg, preferably using pip or easy_install, since those will install the prerequisite packages.
backendto TkAgg (because it is standard and available out of the box). Users who prefer WxAgg must install wxPython and should make a matplotlibrc file that specifies WxAgg as the preferred backend. Look for the line starting with #backend, uncomment it and set it to TkAgg:
backend = TkAgg
## Date/timezone support, uncomment the next three lines for pytz, dateutil and six and set them True. This will make the resulting binary install those additional packages (overwriting any existing versions). On matplotlib 1.3 and later you will not find these lines and users will have to install their own pytz, dateutil and six.
## Date/timezone support: pytz = True dateutil = True six = True
To create a double-clickable installer package that you and others can use to install matplotlib:
Run Terminal and cd to the top level of the matplotlib source directory:
or you want to run a bdist_mpkg for a particular version of python you can be explicit, for example:
The binary installer will be inside subdirectory
If you wish to have an egg distribution, you can build it as follows:
First edit setupcfg.py and comment out the lines for pytz, dateutil and six (if present) so that they are not built. They should be a dependency of the egg rather than included in the egg.
Then build the egg as follows:
$ python setupegg.py bdist_egg
The egg file will be inside subdirectory
Install matplotlib using your new installer. cd out of the matplotlib source directory and run the tests:
$ python -c "import matplotlib as m ; m.test(verbosity=1)"
Save your /usr/local in case you wish to do future builds, and move your normal /usr/local back into place (if you had one):
$ sudo mv /usr/local /usr/local-static $ sudo mv /usr/local-disabled /usr/local
Before distributing the binary installer I recommend a few cleanup steps:
Many thanks to Charlie Moad and mpsuzuki for help with installation instructions and to Sandro Tosi and Derek Homeier for testing instructions.
Russell Owen University of Washington PO Box 351580 Seattle, WA 98195-1580 rowen uw edu @ .