Development Environment Setup on MacOsX

This document describes how to configure your system so that it can meet our recommendation for a development environment for Wikidot version 2.

Our reference dev platforms are mostly Mac systems and below we describe how to turn your Mac into an ultimate dev machine.


In most cases to effectively develop Wikidot, a local working server-installation is required. This includes Apache2, PostgreSQL 8.3 and PHP 5.2.X + extensions and a lot of supporting software.

One of the best (and nicest) way to install open-source software on a Mac is to use MacPorts that are very similar to ports system on BSD machines and also resembles Gentoo/Portage in some ways. You should be familiar with MacPorts if you want to follow this path, but this guide can make you an expert within minutes.

This is not really the place to advocate for MacPorts, but if you learn it now it can save you hours later.

If you do not have MacPorts yet, grab it from

Our only modification to vanilla MacPorts is the /opt/local/etc/macports/variants.conf which contain suggested flags:

+apache2 +pear +postgresql +tidy +smb +x11 +perl +python +php +php5 +sqlite

When installing software with MacPorts, root-privileges are required. Instead of performing "sudo …" all the time you can also try:

sudo su -
# enter your password (of course if you are a sodoer)
export LC_ALL="en_US.UTF-8"

The goal if the installation is to pass all the PHPUnit tests that are bundled with the Wikidot v 2. Over 200 tests (and growing) cover most of the functionality of Wikidot and include database layer tests, transformations tests, webflow tests and others.


Wikidot v. 2 uses PostgreSQL 8.3 or later. Get it and initialize the database with:

port install postgresql83
# initialize the db cluster
mkdir -p /opt/local/var/db/postgresql83/defaultdb
chown postgres:postgres /opt/local/var/db/postgresql83/defaultdb
su postgres -c '/opt/local/lib/postgresql83/bin/initdb -D /opt/local/var/db/postgresql83/defaultdb'
# to start the server
/opt/local/etc/LaunchDaemons/org.macports.postgresql83-server/postgresql83-server.wrapper start

(Hopefully this comes with all the goodies like XML support, full-text indexing etc.)

Now you have the server up and running. By default it is running on port 5432 — in case it is not available, you can change it by editing /opt/local/var/db/postgresql83/defaultdb/postgresql.conf . Later we assume that it is running on port 5432.

One more thing is to create the database itself for Wikidot and a database for tests. The following users and databases will be created:

main database:

  • user: wd2dev
  • password: wd2devpass
  • database: wd2dev

database for unit tests:

  • user: wd2dev_t
  • password: wd2devpass_t
  • database: wd2dev_t
psql83 -U postgres postgres
CREATE USER wd2dev PASSWORD 'wd2devpass';
CREATE USER wd2dev_t PASSWORD 'wd2devpass_t';
CREATE DATABASE wd2dev_t OWNER wd2dev_t;

Verify by trying to connect form the command-line using:

psql83 -U wd2dev wd2dev

Note that the default configuration does not require you to authenticate with the password when connecting locally. If this is an issue, change it by editing /opt/local/var/db/postgresql83/defaultdb/pg_hba.conf

Later you might also need to recreate the database. The simplest way is to drop it and create again. You already know how to create, dropping is even easier: DROP DATABASE wd2dev;

Apache2 & PHP — aka the application server


We are currently using Apache 2.2.X and PHP 5.2.X. Once new PHP version is available we will most probably switch to it. There is also a (blurry) idea to switch to PHP6 ASAP and benefit from namespaces, native UTF8 support and a few other things, but probably we will just wait until PHP6 gets better (or any) support from IDEs.

Installation of base Apache+PHP is fast:

port install apache2 php5

Now time to add some flavour to this PHP5

Extra software and extensions

We need some binary extensions to the PHP engine. For most of them the easiest way to get them will be to use PECL :: The PHP Extension Community Library (

We will need: xdiff, memcached, eaccelerator (optional), fileinfo (please someone replace it!!!)


Unfortunately the xdiff library needs to be compiled from scratch, no port is provided for libxdiff. The complete commandset is:

# install libxdiff first
cd /usr/src
tar -xzf libxdiff-0.22.tar.gz
cd libxdiff-0.22
make install
# and this will install the PHP binding for libxdiff
pecl install xdiff


Memcached is one of the best distributed caching systems and is used by many of the popular websites (like Slashdot, Digg, LiveJournal). Caching should not be enabled by default, but it is now.

# install the memcached server 
port install memcached
# install PHP bindings
pecl install memcache

To run the server simply do (add more parameters if you need):

memcached -u nobody -d -l

By default it listens on port 11211 — there is absolutely no authentication so make sure you either add -l or are behind a firewall.

Eaccelerator / APC

This is something you would need for 2 reasons: it speeds up initial load when loading a php script in Apache and provides ultra-fast caching. At the moment however neither Eaccelerator nor APC are not required.

Note: we might need APC later because it adds nice "file upload progress" feature.


  • Fileinfo: not required at the moment
  • ImageMagick: not required yet
  • LaTeX (TeTeX): not required yet


Development tools

Get the software!

Checkout Wikidot into workspace

By now you should have the Eclipse (or Zend Neon) installed. Simply add a new SVN repository (read more here) and checkout "wikidot2/trunk".

Get dependencies

Zend Framework

The cleanest way to get Zend Framework into your workspace is to… checkout it directly from (add a new SVN repo and checkout either form the trunk or a recent tagged release).

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License