Geert JM Vanderkelen

Building MySQL universal binaries using MacOS X 10.6 (Snow Leopard)

Building MySQL universal binaries using MacOS X 10.6 (Snow Leopard)

On the eve of 2010.. and your boss wants to stick to these MacOS X 10.5 machines, too stubborn or chicken to upgrade. Some developers still have their old PowerBook laptops and they need MySQL flying on PowerPC machines. To top it all, one guy said he wanted to have 32 and 64-bit in one bite. *Sigh* .. But there is an easy way out! A universal binary!

This post shows you a way to create MySQL universal binaries using MacOS X 10.6 so you can run them on MacOS X 10.5/10.6 whether it is PowerPC or Intel, or 32bit or 64bit.

However, if you need libmysqld (Embedded MySQL), this post will not work for you.


  • You have MacOS X 10.6 with latest Xcode (fully) installed.
  • The MySQL source unpacked somewhere. Get it on the MySQL download website under Source Downloads, package named Compressed GNU TAR archive (tar.gz).
  • And some nerves for when the build process fails.

Most complete Universal Binary

First, here is away to build MySQL so it runs on MacOS X 10.5 Intel/PowerPC and 10.6 32 or 64-bit.

Here is the source of the build script names Executed it while located inside the source directory of MySQL.


SDK="-isysroot /Developer/SDKs/MacOSX10.5.sdk"

ARCH="-arch i386 -arch x86_64 -arch ppc"

export CFLAGS="-O2 -fPIC $ARCH $SDK"
export CXXFLAGS="-O2 -fPIC $ARCH $SDK"


INSTALL="/usr/bin/install -c"

./configure --prefix=$PREFIX \
--disable-dependency-tracking \
--mandir=$PREFIX/share/man --infodir=$PREFIX/share/info \
--localstatedir=$PREFIX/var/ --libdir=$PREFIX/lib \
--bindir=$PREFIX/bin --libexecdir=$PREFIX/bin \
--includedir=$PREFIX/include \
--datadir=$PREFIX/share/ --sysconfdir=$PREFIX/etc \
--with-extra-charsets=complex \
--with-mysqld-user=mysql \
--without-docs \
--with-plugins=all \
--enable-thread-safe-client --without-embedded-server \
--with-pic --with-libedit

if [ $? -eq 0 ]; then
    make clean
    time make -j 2

Here is what file shows for the mysqld binary:

Black:mysql-5.1.42 geert$ file sql/mysqld
sql/mysqld: Mach-O universal binary with 3 architectures
sql/mysqld (for architecture i386): Mach-O executable i386
sql/mysqld (for architecture x86_64): Mach-O 64-bit executable x86_64
sql/mysqld (for architecture ppc7400): Mach-O executable ppc

These binaries were tested and work on MacOS X 10.6 Intel and MacOS X 10.5 PowerPC.

32/64-bit Universal binaries for MacOS X 10.6

Same as above, but with the following changes:

SDK="-isysroot /Developer/SDKs/MacOSX10.6.sdk"

Setting the above is probably not needed when you are already on a Mac running 10.6, but it doesn’t hurt to be explicit.

Need it for MacOS X 10.4?

I gave this a spin:

SDK="-isysroot /Developer/SDKs/MacOSX10.4u.sdk"
ARCH="-arch i386 -arch ppc"

But it failed with

  error: stdarg.h: No such file or directory

.. but I lack intrest making stuff for MacOS X 10.4 (Tiger). Consider this your homework!

2 thoughts on “Building MySQL universal binaries using MacOS X 10.6 (Snow Leopard)

  1. mordred

    AWESOME. Thanks for posting this. I just tried applying this to libdrizzle and it worked like a charm. I didn't need to reference the -isysroot or -Wl,-syslibroot options though. (Actually, they broke things for me) But just specifying multiple -arch options worked like a charm!

    I think I'm going to go add support for this into pandora-build. Thanks again!

  2. Michael H Buselli

    I read somewhere you can get the 10.4 build to work by using gcc-4.0 instead of gcc-4.2. If someone tries this by changing CC, CXX, and OBJC to the appropriage gcc-4.0 values then please let me know if it works!

Leave a Reply

Your email address will not be published. Required fields are marked *

− 4 = 5

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>