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:
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. First we need to change a file with source code as otherwise it will generate an error during compilation. The file is ‘src/util/sys_defs.h‘ and you need to change line 206 from
into
When done Issue the following commands as a normal user:
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:
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’.



9:20 am
Hi Richard,
Just a question. When you mention normal user, can this be the main user I use (administrator) or do I need to create a new one?
My main user is also the root user.
Rgds
Luc
9:26 am
Luc, the normal user is a regular OS X user account which can have an administrator role. You should not enable the root user (per default disabled on OS X) or use it on a daily basis, only use ’sudo’ to execute commands with root privileges.
This is not OS X specific, but common practice on any unix platform.
10:57 am
Thanks,
That’s what I understood of it.
Luc
10:52 am
Hi.
I was getting an error like this when sudo make installing:
Undefined symbols:
“_db_version”, referenced from:
_dict_db_open in libutil.a(dict_db.o)
“_db_create”, referenced from:
_dict_db_open in libutil.a(dict_db.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [master] Error 1
make: *** [update] Error 1
which I’ve seen in a couple of places on this site. I read that these are apparently Berkeley DB errors, not mysql errors. I added a ‘-ldb’ to the end my AUXLIBS string and it compiled. FWIW
2:23 pm
Are you certain you want to disable something pertaining to name resolution when building postfix ?
In the postfix source, within dns.h , we see:
#ifdef RESOLVE_H_NEEDS_NAMESER8_COMPAT_H
#include
which is available from Apple,
http://opensource.apple.com/source/Libinfo/Libinfo-324/dns.subproj/
which is a subdirectory of
mac-os-x-1061 source code at the site.
Put
7:40 pm
@David, it was required to get this version of Postfix compiled on Snow Leopard. If you have another working solution I would love to hear about it.
4:33 am
Hi, I came across your site while troubleshooting this issue at my own site, but I did a bit of further digging and found that Mac OS X 10.6 no longer has an include file named nameser8_compat.h, which is the source of the issue. The equivalent file now seems to be arpa/nameser_compat.h. Updating the Postfix dns.h file (line 23) to include this file instead finally resulted in a good build, and so far seems to be running just fine here.
I’ve reported the issue to Wietse (Postfix author), the next build should properly check for Snow Leopard and compile properly using this change.
5:39 am
@Jim, thank you very much for this. Hope it will work out.