If you are planning on running Tomcat in a production environment, it is advisable that you install the native library. The native library will improve the performance of your Tomcat installation.

The OS X developer tools must be installed.

Download and unpack Apache Portable Runtime (APR)

Download apr-1.3.x-src.tar.gz source release archive from the Apache APR Download Page

Unpack the source code into the directory of your choice. /usr/local/src is a suggestion.

Build and install APR

# Change to the APR source directory
cd /usr/local/src/apr-1.3.x

# Build the make file
./configure

# Users of 64-bit Java 6 should use the following configure command:
CFLAGS='-arch x86_64' ./configure

# Make the library
make

# Test the build (Takes a while)
make test

# Install APR
make install

Build the Tomcat Native Library

# Change directories to Tomcat Binaries
cd /Library/Tomcat/Home/bin

# Unpack the native library source code
tar -xvzf tomcat-native.tar.gz

# Change into the native source directory
cd tomcat-native-1.1.20-src/jni/native

# Build the make file for Java 5
./configure --with-apr=/usr/local/apr --with-ssl=/usr # With SSL
./configure --with-apr=/usr/local/apr --without-ssl # Without SSL

# Build the make file for Java 6
./configure --with-apr=/usr/local/apr --with-ssl=/usr --with-java-home=/System/Library/Frameworks/JavaVM.framework/ # With SSL
./configure --with-apr=/usr/local/apr --without-ssl --with-java-home=/System/Library/Frameworks/JavaVM.framework/ # Without SSL

# Users of 64-bit Java 6 should use the following configure command:
CFLAGS='-arch x86_64' ./configure --with-apr=/usr/local/apr --with-ssl=/usr/ssl --with-java-home=/System/Library/Frameworks/JavaVM.framework/

# Make
make

# Copy the native library to /usr/lib/java
sudo cp .libs/libtcnative-1.0.1.20.dylib /usr/lib/java

# Create a symbolic link in /usr/lib/java to the native library
cd /usr/lib/java
sudo ln -sfhv libtcnative-1.0.1.20.dylib libtcnative-1.dylib
sudo ln -sfhv libtcnative-1.dylib libtcnative-1.jnilib

# Restart Tomcat
cd /Library/Tomcat/Home/bin
./shutdown.sh
./startup.sh

# Check the log to make sure APR is loaded
cd ../logs
tail -n 30 catalina.out
You should see the following message:
INFO: Loaded APR based Apache Tomcat Native library 1.1.20.

# There has been a problem with the pollersize setting that has appeared, disappeared and then reappeared. If you get the error:
INFO: Failed to create poller with specified size of 8192
You will have to edit server.xml.
cd ../conf
nano server.xml

# Change the following line ...
<!-- Define an AJP 1.3 Connector on port 8009 -->
<Connector port="8009" protocol="AJP/1.3" redirectPort="8443" />

# To ..
<Connector port="8009" protocol="AJP/1.3" pollerSize="1024" redirectPort="8443" />