CourierImap 3.0.8 on OSXS 10.3+ (PANTHER)

Login as "root" on your terminal and create user and group for Courier.

niutil -create . /groups/courier
niutil -createprop . /groups/courier gid 100
niutil -createprop . /groups/courier realname 'courier'
niutil -create . /users/courier
niutil -createprop . /users/courier uid 100
niutil -createprop . /users/courier gid 100
niutil -createprop . /users/courier passwd '*'
niutil -createprop . /users/courier realname 'courier'

Log-in again via terminal, this time as user "Courier":

login courier
password secret

Download, unpack .tar .gz archive and change directory:

curl -O http://aleron.dl.sourceforge.net/sourceforge/courier/courier-imap-3.0.8.tar.bz2
bunzip2 courier-imap-3.0.8.tar.bz2
tar -xvf courier-imap-3.0.8.tar
cd courier-imap-3.0.8

Create install script

cat > ../courier.Build
#! /bin/sh
RANLIB="ranlib -c"
CFLAGS="-traditional-cpp"
CXXFLAGS="-traditional-cpp"
export RANLIB
export CFLAGS
export CXXFLAGS
CC=gcc3 ./configure \
--prefix=/usr/courier-imap \
--with-waitfunc=wait3 \
--enable-unicode \
--with-authmysql \
--without-ipv6 \
--without-authldap \
--enable-workarounds-for-imap-client-bugs

Do a "control C" to end the "cat >" process. That will create a file called courier.Build in the Courier User's folder.

chmod 775
../courier.Build
make
make check  

Note - the --enable-workarounds-for-imap-client-bugs option to configure will result in make check FAILING.

su root
umask 022
make install

Or, make install-strip, to strip the executables and finally install configuration files.

make install-configure
cp /Users/courier/courier-imap-3.0.3/authlib/authtest  /usr/courier-imap/libexec/authlib

If "make check" pulls up an error because it has difficulties finding mysql stuff, you will have to edit "mysql_config" (/usr/bin/mysql_config) by altering the following line:

Instead of: ldflags='-arch i386 -arch ppc -pipe'
Use: ldflags=''

Open via terminal and than add the following line to hostconfig file:

open -e /private/etc/hostconfig

IMAPSERVER=-YES-

Turn off the "sticky bit" on - /private/var/mail

chmod -t /private
chmod -t /private/var
chmod -t /private/var/mail

and set the owner on "mail" folder to courier and group to "courier".

chown -R courier /private/var/mail
chgrp -R courier /private/var/mail
chmod -R 775 /private/var/mail