Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Is it possible to use mysql tables in postfix under OS X (Snow Leopard, not server)? For example, in

canonical_maps = mysql:/private/etc/postfix/

Using postconf -m to list all lookup table types, I can see that mysql is not among the default supported types for the default installation.

I'm aware that I can install a different version of postfix with mysql support (e.g., from macports), but I'd rather not do that as it wants to also compile both it's own version of apache and mysql, both of which I don't need.

My question therefore is twofold. First, is there some way to make the default installation of postfix in OS X use mysql tables? Second, is there a proscribed way of installing (either via a reputable binary or by compilation) a version of postfix that will either replace or not interfere with (so as to allow me to use either version) the existing version?

Or am I simply stuck with macports?

share|improve this question
up vote 2 down vote accepted

I was eventually able to install postfix from source, with some hints from an article at entitled Compiling Postfix in 64 bits on Snow Leopard. This allowed me to compile a customized version of postfix with mysql table lookup support.

The gist of the install:

First, install MySQL. I used a binary .pkg downloaded via, and it worked well. Also download and unpack postfix source into a convenient location.

In the postfix source, you'll need to change a line of code (line 206) in src/util/sys_defs.h from:




You'll then need let postfix know that you want to include mysql table support in the configuration. The source article includes a more hefty configuration than the one I present here, which (as far as I know) is minimally sufficient to enable mysql table support:

make -f Makefile.init makefiles CCARGS='-arch x86_64'            \
 '-DHAS_MYSQL -I/usr/local/mysql/include'                        \
 AUXLIBS='-L/usr/local/mysql/lib -lmysqlclient -lz -lm -lresolv'

Once that's finished, you're ready to compile in earnest, by simply typing make. Once the compile completes, you'll perform the install:

sudo make install

When prompted for configuration values, you should be able to use the defaults with no problems.

The major drawback of this solution is that it replaces the existing installation of postfix with the newly compiled version, rather than allowing them to coexist. Configuration can be supplied to change the default installation locations however, and therefore should be suitable for having multiple instances of postfix available on the same system simultaneously.

share|improve this answer
thanks for linking to Just to let you know that the instructions you are using (like the editing of the source code) are a bit outdated. Please use the newer instruction located here: In the new instructions we’ve re-located the installation of our Postfix version to /usr/local/ to make sure that updates from Apple (like security updates) don’t affect our changes. – user92918 Aug 27 '11 at 9:48

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.