Get the latest source code from www.postfix.org, 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 mail box support, SASL for authentication and the SSL options to enable TLS support. Recently I found that PCRE support is also required if you want to use the complex filters in Postfix.

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:

CFLAGS="-arch x86_64" \
CXXFLAGS="-arch x86_64"
./configure
 
make
 
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 \
CCARGS='-arch x86_64 -DUSE_TLS -DUSE_SASL_AUTH \
-DDEF_SERVER_SASL_TYPE=\"dovecot\" \
-DHAS_PCRE -I/usr/local/include \
-DHAS_SSL -I/usr/include/openssl \
-DHAS_MYSQL -I/usr/local/mysql/include/mysql' \
AUXLIBS='-L/usr/lib -llber -lresolv -L/usr/local/lib \
-L/usr/local/lib -lpcre -lssl -L/usr/local/mysql/lib/mysql \
-lmysqlclient -lz -lm'

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.

Please note that for the dependencies on directories I’m assuming you’ve got MySQL installed from my previous instructions in 64 bits. If not please check the location of the MySQL files mentioned in the configuration. You can find out which configuration on your system is active by running the command ‘mysql_config’.