Get the latest source code from, check the blog for the latest tested version. I’m compiling Postfix with several options to help me achieve the flexibility and the security needed. We require the MySQL support for virtual mailbox support, SASL for authentication, PCRE for using the complex filters and the SSL options to enable TLS support.

First you need to install the PCRE library (Perl Compatible Regular Expressions), to enable fancy filtering in Postfix. Download the source code from the site. You can compile and install it by running the following commands:

sudo make install

Unpack the Postfix source into a directory, use the Terminal and ‘cd’ into the directory where you unpacked it. When done issue the following commands as a normal user:

make -f Makefile.init makefiles \
-DDEF_SERVER_SASL_TYPE=\"dovecot\" \
-DDEF_COMMAND_DIR=\"/usr/local/sbin\" \
-DDEF_CONFIG_DIR=\"/usr/local/etc/postfix\" \
-DDEF_DAEMON_DIR=\"/usr/local/libexec/postfix\" \
-DHAS_PCRE -I/usr/local/include \
-DHAS_SSL -I/usr/include/openssl \
-DHAS_MYSQL -I/usr/local/mysql/include' \
AUXLIBS='-L/usr/lib -llber -lresolv -L/usr/local/lib \
-L/usr/local/lib -lpcre -lssl -L/usr/local/mysql/lib \
-lmysqlclient -lz -lm'

This will configure the compilation procedure to compile and install postfix using all the items I’ve previously indicated. Here we also configure the locations of the software and configuration which we are moving to a non-default location to prevent Apple overwirting everything during a OS update. The binaries will now be located in /usr/local/sbin and the configuration will be in /usr/local/etc/postfix.

To compile and install Postfix run:

sudo make install

For the questions that are asked at the end of the compilation accept the default values for most of the question. The two exceptions are for:

mail_owner: [postfix]  _postfix
setgid_group: [postdrop]  _postdrop