Last updated February 19, 2008. Created on January 22, 2004.
Edited by ax, add1sun, pwolanin, jvandyk. Log in to edit this page.

Install and configure MySQL and PHP. You can get Mac binaries for OS X 10.3 and 10.4 from MySQL. PHP is also available from Marc Liyanage.

The stock version of Apache that comes with your Mac should be fine.

Turn on "personal web sharing" in the sharing panel of System Preferences to start Apache. Now comes the more involved part- changing the webserver configuration.

To make changes to the Apache configuration you should NOT edit /etc/httpd/httpd.conf but instead edit files in /private/etc/httpd/users/. Any file in the directory /private/etc/httpd/users/ ending with “.conf” will effectively be appended to /etc/httpd/httpd.conf. So any changes you want to make should be made in one or more configuration files of your own construction. System updates will leave these files untouched. You can create a file /private/etc/httpd/users/drupal.conf for all your Drupal-specific changes (even if you have no user named Drupal) and they will be loaded when Apache starts up.

Note: for Mac OS X Server 10.4 (Tiger Server) and most likely previous versions as well, do not make changes to /etc/httpd/httpd.conf expecting the AllowOverride All directive to work. The correct file to add the AllowOverride All directive is in the directory /etc/httpd/sites/. In that directory are the virtual host configuration files. Each virtual server has a configuration file in that directory so it is in those files that you must enable AllowOverride All. If you only have one web server on your server configured, then the file you want to modify is /etc/httpd/sites/0000_any_80_.conf.

To enable clean URLs you will need the following code in your conf file. You'll need to be root (or sudo) to do this. Don't forget to restart apache after modifying httpd.conf (turn personal web sharing off, then back on again, or use /usr/sbin/apachectl restart).

# This controls which options the .htaccess files in directories can
# override. Can also be "All", or any combination of "Options", "FileInfo",
# "AuthConfig", and "Limit"
#    AllowOverride None
        AllowOverride All

You may also need to edit this file to enable the PHP module for Apache. You have to uncomment two lines. First in this section:

# Dynamic Shared Object (DSO) Support

Uncomment this line (around line 235) by removing the #:

#LoadModule php4_module        libexec/httpd/

Then go below to this section:

#  Reconstruction of the complete module list from all available modules
#  (static and shared ones) to achieve correct module execution order.

and uncomment this line (around line 278) by removing the #:

#AddModule mod_php4.c

Drupal goes into /Library/WebServer/Documents/, or ~/Sites. If you use ~/Sites, you may also have to edit the .conf file in /etc/httpd/users that corresponds to your user account. You must AllowOverride in this file for your ~/Sites for clean URLs to work there.

After any edits to your .conf files, be sure to restart Apache (as described above).

MacZeaolots has a good tutorial on installing Drupal on Mac OS X 10.4. The same tutorial applies to 10.3 as well. While the tutorial talks about Drupal 4.6, the setup of the server environment is the same for any version of Drupal.

Important notes for MySQL install:

The version of PHP that Apple included with Mac OS X 10.4.4 has mysql.default_socket set to "/var/mysql/mysql.sock", while the binary version of MySQL from uses "/tmp/mysql.sock". This will cause PHP to fail to connect to mysql with a message in Drupal like

can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)

Make PHP look for "/tmp/mysql.sock" by setting this in /etc/php.ini:

; Default socket name for local MySQL connects.  If empty, uses the built-in
; MySQL defaults.
mysql.default_socket = /tmp/mysql.sock

You can instead set this in /etc/my.cnf.

#Name of the socket file to use.

Both work, but the second one may make the MySQL preference pane stop working.

You may also need to restart apache to have this take effect.

Restart from the terminal:

$ sudo apachectl restart

or restart by disabling and re-enabling personal web sharing.

Looking for support? Visit the forums, or join #drupal-support in IRC.