Skip Navigation

Installing a Newer libxml2 on Mac OS X 10.5

By Robert Crews

Mac OS X 10.5 ("Leopard") includes libxml2 2.6.16 and libxslt 1.1.12. Some programs require newer versions, such as PostgreSQL, which requires libxml2 2.6.23 or later. This procedure describes how to add a newer version of these libraries to your system without disturbing the preinstalled versions already present. This allows you to use the newer versions as needed while allowing other software to continue using the older versions as intended. I wrote these instructions as I added libxml2 2.6.30 and libxslt 1.1.22 to my system.

To install a newer libxml2 on Mac OS X 10.5:

  1. Download the compressed disk image for Mac OS X 10.5 from http://www.explain.com.au/oss/libxml2xslt.html (which is linked to from the Downloads link from the libxml2 home page).
  2. Mount the disk image and drag libxml.framework, libxslt.framework, and libexslt.framework to /Library/Frameworks.
  3. Drag xmllint, xsltproc, and xmlcatalog to /usr/local/bin. Depending on the privileges you set on /usr/local/bin, you might need to authenticate to complete the drag.
  4. Create links in /usr/local to the config scripts, the dynamic libraries, and the headers in the frameworks you just added. Here is the script I used:
    #!/bin/sh
    sudo mkdir -p /usr/local/bin
    cd /usr/local/bin
    sudo ln -s /Library/Frameworks/libxml.framework/Resources/Scripts/*
    sudo ln -s /Library/Frameworks/libxslt.framework/Resources/Scripts/*
    
    sudo mkdir -p /usr/local/include
    cd /usr/local/include
    sudo ln -s /Library/Frameworks/libxml.framework/Headers/*
    sudo ln -s /Library/Frameworks/libxslt.framework/Headers/*
    sudo ln -s /Library/Frameworks/libexslt.framework/Headers/*
    
    mkdir -p /usr/local/lib
    cd /usr/local/lib
    sudo ln -s /Library/Frameworks/libxml.framework/libxml libxml2.dylib
    sudo ln -s /Library/Frameworks/libxslt.framework/libxslt libxslt.dylib
    sudo ln -s /Library/Frameworks/libexslt.framework/libxslt libexslt.dylib
    
    sudo mkdir -p /usr/local/man/man1
    sudo mkdir -p /usr/local/man/man3
    echo 'export PATH=/usr/local/bin:$PATH' >> ~/.bashrc
    echo 'export MANPATH=/usr/local/man:$MANPATH' >> ~/.bashrc
    source ~/.bashrc