Building OpenLDAP Server on Mac OS X

Prerequisites

Login as root user or use the sudo command where appropriate.

Download and install the latest Xcode.

Download and install the latest DarwinPorts. Run self update:

port -d selfupdate

Installing OpenLDAP Source Code

Execute the following command to download OpenLDAP source code:

port extract openldap

Run the following command to display the OpenLDAP port directory:

port dir openldap

We will refer to this directory as OPENLDAP_PORT. The OpenLDAP source code is located in OPENLDAP_PORT/work/openldap-2.2.28.

Patching OpenLDAP

Edit OPENLDAP_PORT/Portfile and add --enable-java parameter:

configure.args  --mandir=${prefix}/share/man \
                --localstatedir=${prefix}/var/run \
                --with-cyrus-sasl \
                --with-tls \
                --enable-java \
                --enable-wrappers

Apply the patch:

cd JAVA_BACKEND_HOME
ant -Dopenldap.src=OPENLDAP_PORT/work/openldap-2.2.28 -Dopenldap.version=2.2.28 patch

Building OpenLDAP

Run the following command to build OpenLDAP:

port build openldap

Installing OpenLDAP

Run the following command to install OpenLDAP:

port install [-k] openldap

You can specify -k option to retain the source code after installation.

By default the slapd will be installed under /opt/local/libexec directory, and the slapd.conf will be installed under /opt/local/etc/openldap.

Create this directory:

mkdir -p /opt/local/var/run/openldap-data

To run slapd:

cd /opt/local/libexec
./slapd -d 65535

References