Adding the libxml2 and libxslt Python bindings to Mac OS X Tiger

Mac OS X 10.4 Tiger comes with Python, libxml2 and libxslt installed by default, but there are no bindings for using libxml2 and libxslt from Python. If you have the developer tools installed, it’s not that hard to add these.

Compile and install the python module of libxml version 2.6.16 using:

curl -O ftp://ftp.gnome.org/pub/GNOME/sources/libxml2/2.6/libxml2-2.6.16.tar.gz tar xvfz libxml2-2.6.16.tar.gz cd libxml2-2.6.16/python python setup.py build python setup.py install cd ../../

Compile and install the python module of libxslt version 1.1.11 using:

curl -O ftp://ftp.gnome.org/pub/GNOME/sources/libxslt/1.1/libxslt-1.1.11.tar.gz tar xvfz libxslt-1.1.11.tar.gz cd libxslt-1.1.11/ ./configure --with-python=/System/Library/Frameworks/Python.framework/Versions/2.3/ make cd python cp libx*.py /System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/ cp .libs/libxsltmod.so /System/Library/Frameworks/Python.framework/Versions/2.3/lib/python2.3/site-packages/ cd ../../
Note: If you were looking at this page in a more modern browser like Mozilla Firefox or Safari, it would look and work better and faster.
Find out more…