Installing MySQL and Apache on OSX 10.5 Leopard

March 6th, 2008 | Reference, Software |

Up to now I’ve used MAMP to get MySQL and Apache up and running quickly on my mac. I prefer to get under the hood as such when I have the time and set these things up individually. In this post I’ll go through simply installing the MySQL5 package and then build and install Apache2.

MySQL
I was going to build MySQL 5.0.x from source but I found a handy binary for OSX 10.5 on the mysql website so grabbed that instead. The install is quite straight forward, follow the readme and you’re golden.
Get the MySQL 5 package here: http://dev.mysql.com/downloads/mysql/5.0.html#macosx-dmgv
Once mysql is installed you may want to add it to your path with the following:

sudo export PATH=$PATH:/usr/local/mysql/bin

Apache
I haven’t much choice but to build Apache. Before you go any further you should download and install Xcode to ensure that you have everything you need to build from source. I’m going with Apache 2.0.68 tarball picked up from the Apache Download Page.

I extracted the source. Set the install location first, as per the INSTALL instructions. Within the Apache source directory execute the following.

./configure --Prefix=/usr/local/apache2

If you want to install apache2 elsewhere change /usr/local/apache2 to your desired path.

The configure script will go off and do its thing for a minute or so.

Now you can run make command.

Note: If make drops out with the following error: #error APR has detected sendfile on your system, but nobody has written a
sendrecv.c
, never fear. All you need to do is edit apr.h (found in srclib/apr/include OR a quick spotlight search will find it too). You want to change the following line (in or around line 220):

#define APR_HAS_SENDFILE 1

To

#define APR_HAS_SENDFILE 0

Save the file and run make again. It worked fine for me then.

When make is finished run sudo make install, it should just take a few seconds and you’re done.

Start up apache with sudo /usr/local/apache2/bin/apachectl start and visit http://localhost in your browser to confirm that apache is up.


Leave a Reply