Get the latest source code from postfix.org, I’ve used version 2.3.3. This was the latest version when I checked. I’m compiling it with several options to help me achieve the flexibility and the security I need. I’m requiring 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.
As a precautionary measure, you may want to backup the old Postfix executables before installing the new version. The following commands may be used as an example of how to do this (you can only do this as a root user):
cd /usr/sbin mkdir -p postfix-2.0.10.apple cp -p post* postfix-2.0.10.apple cp -p /usr/bin/mailq postfix-2.0.10.apple cp -p /usr/bin/newaliases postfix-2.0.10.apple cp -p sendmail postfix-2.0.10.apple cd /usr/libexec mkdir -p postfix-2.0.10.apple cp -Rp postfix/* postfix-2.0.10.apple
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, I’ve used version 6.7 in my setup. You can compile and install it by running the following commands for both Intel and PowerPC based macs:
./configure make sudo make install
If you made the copy of the original Postfix and installed the PCRE library you are ready to start. Unpack the 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:
make -f Makefile.init makefiles \ 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' \ 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:
make -f Makefile.init makefiles \ 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' \ 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:
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. 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’ as documented here.
June 28th, 2006 at 1:00 am
While attempting the above install, I encounter the following error:
/usr/bin/ld: multiple definitions of symbol _SSL_write
/usr/lib/libssl.dylib(ssl_lib.o) definition of _SSL_write
/usr/local/mysql/lib/libmysqlclient.a(ssl.o) definition of _SSL_write in section (__TEXT,__text)
collect2: ld returned 1 exit status
make: *** [error] Error 1
make: *** [update] Error 1
I have confirmed all of the mysql settings:
Usage: /usr/local/mysql/bin/mysql_config [OPTIONS]
Options:
–cflags [-I/usr/local/mysql/include -Os -arch ppc -fno-common]
–include [-I/usr/local/mysql/include]
–libs [-L/usr/local/mysql/lib -lmysqlclient -lz -lm]
–libs_r [-L/usr/local/mysql/lib -lmysqlclient_r -lz -lm]
–socket [/tmp/mysql.sock]
–port [3306]
–version [5.0.22]
–libmysqld-libs [-L/usr/local/mysql/lib -lmysqld -lz -lm]
This is a fresh install of OSX and all packages are from those listed in the tutorials.
Any suggestions?
Thanks!
October 6th, 2006 at 5:46 am
hello. Paul.
Passing the client of MySQL is wrong.
–It is likely to write like this. –
make -f Makefile.init makefiles \
CFLAGS=’-arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk’ \
CCARGS=’-DUSE_TLS -DUSE_SASL_AUTH -DUSE_CYRUS_SASL \
-I/usr/local/include/sasl \
-DHAS_SSL -I/usr/include/openssl \
-DHAS_MYSQL -I/usr/local/mysql/include’ \
AUXLIBS=’-L/usr/lib -lldap -L/usr/lib -llber -L/usr/local/lib \
-lssl -lsasl2 -L/usr/local/mysql/lib \
-lmysqlclient -lz -lm’
November 14th, 2006 at 7:03 am
When trying to backup Apple Postfix, I get this:
$ sudo cd /usr/sbin
$ sudo mkdir -p postfix-2.0.10.apple
$ sudo cp -p post* postfix-2.0.10.apple
cp: postfix-2.0.10.apple is a directory (not copied).
James.
November 14th, 2006 at 7:28 am
@James: Do the others get copied ? A directory can not be copied into itself so it’s not an real issue…
January 2nd, 2007 at 7:53 pm
I would echo the comments of ipod-groove, above. The path to the directory for the mysql libraries is incorrect above.
Replace:
-L/usr/local/mysql/lib/mysql
with:
-L/usr/local/mysql/lib
Simon
January 2nd, 2007 at 8:40 pm
Please ignore my ignorant comment above! As Richard quite rightly warns at the start of this tutorial, an accurate mySQL installation is key to success! I was missing the shared libraries – fatal!
January 2nd, 2007 at 9:28 pm
Thanks for letting me and all of us know Simon.
July 1st, 2007 at 10:00 am
Hello! This is a fantastic guide … I’m afraid I’ve been struggling with the postfix build for a day now, and can’t work out what I’m doing wrong.
When I do:
sudo make install
it craps out like this:
/usr/bin/ld: Undefined symbols:
_db_create
_db_version
collect2: ld returned 1 exit status
make: *** [master] Error 1
make: *** [update] Error 1
From the earlier guide, it was intimated that older installations of mysql didn’t help much with this – I completely refreshed the mysql install as per this documentation, but it’s not made any difference.
Hoping for some help!
September 25th, 2007 at 6:14 am
Postfix is up now Postfix 2.4 stable release patch 5. I’m going to attempt it and I’ll let you know how it went. Thanks again for a great tutorial.
Did you ever cover Virtual Hosting with dynamic IP? If not I hope you get a chance soon. In the meantime… I’m googling.