SMWCon Fall 2013/Hands-on session. Programming MediaWiki extension/Mac setup


Below there are some steps and recommendations for installing MediaWiki in your Mac OS X.

It's not strictly mandatory, but it will be helpful if you get a bit familiarised with Mac OS X Terminal.

Apache and PHP[edit]

  • Apache (the webserver) and PHP (the main programming language used by MediaWiki) are already installed by default (checked in Mac OS X 10.6.8 - it should work in later versions)
  • Open /private/etc/apache2/httpd.conf.
    • Uncomment / Remove '#' from line LoadModule php5_module
    • If using the terminal, you may need to prepend sudo to the commands, e.g. sudo nano /private/etc/apache2/httpd.conf.
  • Restart Apache: sudo /usr/sbin/apachectl graceful
  • If you don't want to have different virtualhosts (that is working with only one domain), your documents are placed at: /Library/WebServer/Documents. Otherwise, you can define them. Keep in mind therefore that you need to add 'fake domains' in /etc/hosts.
  • In order to know whether PHP and Apache are working ok, we can create a file named info.php in /Library/WebServer/Documents with the following content:

Afterwards, type down in your browser location bar: If you get some detailed information about your system and PHP installation, this means that everything works OK. Note: Don't keep this kind of files in a production server.


  • Apache operations: sudo apachectl restart -> it restarts Apache. Other commands: start, stop, graceful, etc.
  • To have Apache started automatically by default: sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist. More details: man launchctl
  • Apache Short-URL configuration for MediaWiki


  • Install homebrew - Package manager that can help you turn your Mac OS X in a powerful programming environment.
    • Note: Binaries installed by brew can be found in /usr/local/bin
  • Install MariaDB (MySQL-compatible DB engine). Using brew via terminal.


  • Download the latest version of MediaWiki
  • Unpack it into your webserver directory. For default setups, this is likely to be /Library/WebServer/Documents
  • Following MediaWiki convention, rename created directory (e.g. from mediawiki-1.21.2 to w)
  • Open in browser: and follow installation instructions.
  • At the end of the process, you will be prompted to place a LocalSettings.php (main MediaWiki configuration file) under /w
  • You will end up with a wiki under Despite it's not very orthodox, and more elegant way could be via virtualhosts, you can always install other wikis in other subdirectories. Such as: /w1 or /w2.

Other software[edit]

Depending on what you want to do with your wiki, you may need to use other software. An example is imagemagick, for generating thumbnails.

  • Install: brew install imagemagick

in LocalSettings.php you add:

$wgUseImageMagick = true;
$wgImageMagickConvertCommand = '/usr/local/bin/convert';

More links[edit]