Get the latest source code from postfix.org, check the blog for the latest checked version we used. I’m compiling Postfix with several options to help me achieve the flexibility and the security needed. We require the MySQL support for mail box maintenance, 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 filtering options 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 for both Intel and PowerPC based macs:
make
sudo make install
Unpack the Postfix source into a directory, use the Terminal and ‘cd’ into the directory where you unpacked it. Issue the following commands as a normal user:
For Intel:
CFLAGS='-arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk' \
CCARGS='-DUSE_TLS -DUSE_SASL_AUTH -DUSE_CYRUS_SASL \
-I/usr/local/include/sasl \
-DHAS_PCRE -I/usr/local/include \
-DHAS_SSL -I/usr/include/openssl \
-DHAS_MYSQL -I/usr/local/mysql/include/mysql' \
AUXLIBS='-L/usr/lib -lldap -L/usr/lib -llber -L/usr/local/lib \
-L/usr/local/lib -lpcre \
-lssl -lsasl2 -L/usr/local/mysql/lib/mysql \
-lmysqlclient -lz -lm'
For PowerPC:
CFLAGS='-arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk' \
CCARGS='-DUSE_TLS -DUSE_SASL_AUTH -DUSE_CYRUS_SASL \
-I/usr/local/include/sasl \
-DHAS_PCRE -I/usr/local/include \
-DHAS_SSL -I/usr/include/openssl \
-DHAS_MYSQL -I/usr/local/mysql/include/mysql' \
AUXLIBS='-L/usr/lib -lldap -L/usr/lib -llber -L/usr/local/lib \
-L/usr/local/lib -lpcre \
-lssl -lsasl2 -L/usr/local/mysql/lib/mysql \
-lmysqlclient -lz -lm'
To compile and install Postfix for both Intel and PowerPC 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. 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’.
Next step: Building the Courier Auth library



3:29 am
I used your tutorials to add MySQL support to Postfix on OS X Leopard and things work great. However, I’ve noticed that there’s a warning message that pops up a lot in my system.log file. It looks like this:
Jan 25 20:42:09 postfix/smtpd[4039]: SQL engine ‘mysql’ not supported
Jan 25 20:42:09 postfix/smtpd[4039]: auxpropfunc error no mechanism available
Jan 25 20:47:35 postfix/smtpd[4047]: can’t access srvtab file krb__get_srvtabname() is no longer supported.: No such file or directory
Aditionaly, it’s broken Postfix support for native OS X user name log ons. That’s understandable of course since the OS X postfix comes configured for that. Anyone else see the errors above? Any suggestions on how to fix it?
6:36 am
Under Leopard 10.5.1 on intel.
Upon running ’sudo make install’ for Postfix I receive the following error:
Under the [src/smtpd] section …
Undefined symbols:
“_sasl_set_path”, referenced from:
_xsasl_cyrus_server_init in libxsasl.a(xsasl_cyrus_server.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [smtpd] Error 1
make: *** [update] Error 1
SASL 2.1.22 built and installed without issue. All previous directions were followed exactly as documented here.
Any ideas?
9:03 pm
Just got something similar with Tiger.
/usr/libexec/gcc/i686-apple-darwin8/4.0.1/ld: Undefined symbols:
_sasl_set_path
collect2: ld returned 1 exit status
make: *** [smtpd] Error 1
make: *** [update] Error 1
9:07 pm
Please do not use postfix 2.5.0 as there are errors with this release. Please use 2.4.7, I’m working on it…
10:58 pm
I was going through this install (great site, by the way), and tried postfix 2.5.1, even though you said not to. The issue I found was that the mysql and sasl includes were in different places. For the first “make”, I had to change them to:
-I/usr/include/sasl \
and
-DHAS_MYSQL -I/usr/local/mysql/include’ \
The first is probably because sasl is built in, so going to /usr instead /usr/local. The second is probably how I built it, as mysql was built before I came to this site.
I was hoping to avoid rebuilding postfix, but the stock Leopard postfix doesn’t have mysql support compiled in.
2:01 am
and to follow up, I have 2.5.1 working, by change the include page for the SASL. Is it possible that 2.5.1 fixed the issues you were talking about?
Again, great site. This helped me out a lot.
9:44 am
Thanks for mentioning this, I’ll check it out and I will update the documentation accordingly.
4:10 am
Hi, great info on this site.
I have found that i needed to add
export PATH=$PATH:/usr/local/mysql/bin
to successfully build courierauth and postfix.
also i get the following error in my logs.
Jan 25 20:42:09 postfix/smtpd[4039]: SQL engine ‘mysql’ not supported
Jan 25 20:42:09 postfix/smtpd[4039]: auxpropfunc error no mechanism available
Jan 25 20:47:35 postfix/smtpd[4047]: can’t access srvtab file krb__get_srvtabname() is no longer supported.: No such file or directory
when configuring the packages i have also had to trim the config lines to get them to work.
eg.
/usr/local/mysql/includes/mysql
to
/usr/local/mysql/includes
I am running 10.5.3 on intel and ppc