Setup a development environment for Symfony on a Mac with Homebrew

Althougha Mac already comes with an apache and php installed, as soon as you’re starting serious development, you’re going to miss a few things.
There are many package manager out there and until now I used MacPorts.
Unfortunately it has a few downsides which led to MySQL crashing and landing in an unusable state. So I decided it’s time for a new installation and a move towards Homebrew instead.

And it turns out, it wasn’t just a good idea but also quite easy. As I still run into a few problems and didn’t really find a good blog entry about it, I took it as a start to write my own one.

Here are the steps it took me to get everything up and running.


Everything starts with this command line to install Homebrew:

$ ruby -e "$(curl -fsSL"

After that we need to install the formulas:


$ brew tap djl/homebrew-apache2
$ brew install djl/apache2/apache22


$ brew tap homebrew/dupes
$ brew tap josegonzalez/homebrew-php
$ brew install php54 --with-homebrew-openssl --with-intl

At the moment the intl extension seems to be broken in the formular so
we need to install it “manually”:

$ brew install php54-intl

In addition I recommended APC for Symfony:

$ brew install php54-apc

And mcrypt

$ brew install php54-mcrypt


Finally an easy one:

$ brew install mysql




Set server name to a “real” domain name like


Look for index.php file instead of just the index.html file

DirectoryIndex index.html, index.php

Set your own user as user for http process (this is just for convenience and is only for a local development environment)

User YourUser

Remove # at “Include conf/extra/httpd-vhosts.conf” to include the vhost config.


Replace with own vhost config and replace document root of localhost with new path



Load PHP5.4 Module:

LoadModule php5_module /usr/local/Cellar/php54/5.4.19/libexec/apache2/

Add php type to mime_module

AddType application/x-httpd-php .php


Set timezone

date.timezone = Europe/Berlin

Set higher max execution time

max_execution_time = 600

Set higher memory limit

memory_limit = 512M

Set default charset to UTF-8

default_charset = "UTF-8"


Start MySQL on login

$ ln -sfv /usr/local/opt/mysql/*.plist ~/Library/LaunchAgents

Start the environment


The apache start needs to happen with sudo because only root can bind a process to a port below 1024

$ sudo /usr/local/Cellar/apache22/2.2.25/bin/apachectl start


$ mysql.server start

That’s already everything you need to run Symfony on a Mac with all components still under your control.