Note: You are currently viewing documentation for Moodle 2.3. Up-to-date documentation for the latest stable version is available here: Step by Step Installation on a OS X Lion Server.

Step by Step Installation on a OS X Lion Server

From MoodleDocs


This guide shows all steps for the installation of Moodle on a OS X Lion Server - the new name for Mac OS X 10.7 Server. This server is a commercial product. The OS X Lion Server can be used as an inhouse server as well as an internet server. You will find all documentations about the web server on the Apple support pages.

This installation guide can't be useful for an installation on MAMP or XAMPP. If you are looking for an easy way to install Moodle on your local machine please use Complete Install Packages for Mac OS X that can be downloaded from ... but if you are planning to set up a Moodle internet server on a Mac then you should think about some more security as the ever local packages MAMP or XAMPP could give.

Please feel free to add your ideas and wishes to the discussion page for this article. You may also write a complete chapter if you tried the facts yourself on your own OS X Lion Server. I am most interested to make the things better.

System requirements

+ Apple Computer 
+ Mac mini, Mac Pro or Xserve
+ Processor:  Intel Core i3/i5/i7 or Intel Core 2 Duo
+ RAM: 2 GB or better
+ Hard Disk: 500 MB free
+ System Software: OS X Lion Server 10.7

The OS X Lion Server is a pure 64-bit software and does not work on old Macs with G3, G4, G5, Intel Core Solo or Intel Core Duo.

Activate the web server

Configure PHP for Moodle

You should control and set the following php parameters. To activate the new settings you must restart your web server.

; Maximum amount of memory a script may consume (128MB)
memory_limit = 128M

; Maximum size of POST data that PHP will accept. (8M)
post_max_size = 512M

; Maximum allowed size for uploaded files. (2M)
upload_max_filesize = 500M

Install a more complete PHP from LiiP

The php installation in the OS X Lion Server software is not totally complete for Moodle. For example the php intl extension is missing and it's not easy to extend the original php from Apple.

So it's very nice to see that there comes a "one line installer for PHP" from LiiP which writes a complete php without deleting the original one. Please read the blog entry "PHP 5.3 for OS X 10.6 one-line installer" and "PHP 5.3/5.4 for OS X 10.6/10.7 as binary package" on the LiiP server. You can choose to install PHP 5.3 or PHP 5.4 (while this part is written you can get PHP 5.3.13 or PHP 5.4.4). It's very easy to install ... and it's very easy to roll back to the original php (it's 5.3.10 while this part is written).

I you want to use the Postgres database you must fix a very small bug. PHP does not communicate with Postgres because the Postgres socket is published on a wrong place. I don't know very much about this problem but the following tip could help. Open the Terminal and write the command to link the socket to the right place. The patch must be done by the root user so you have to type your password once to get the rights.

sudo ln -s /var/pgsql_socket/.s.PGSQL.5432 /tmp/

Use PostgreSQL on your server

Configure PostgreSQL for Moodle

Install MySQL on your server alternatively

Configure MySQL for Moodle

Copy the Moodle files to your server

Run the Moodle installation

Download the language packs

Setup the cron job with launchd

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">

How to install and update Moodle with git

#! /bin/sh
#  This GIT installer for Mac OS X is part  
#  of the installation package Moodle4Mac
#  20120708 - Ralf Krause

echo "+--------------------------------------------+"
echo "| GIT updater for your Moodle server"
echo "+--------------------------------------------+"

cd /Library/Server/Web/Data/Sites/Default/

if ! test -e moodle23/.git ; then
    ## the first git update must get everything including .git
    sudo git clone --depth 1 -b MOODLE_23_STABLE git:// moodle23-git
    ## if moodle23 already exists 
    ## then we need to get the config.php
    if test -e moodle23
        sudo cp moodle23/config.php moodle23-git/.
        DATE=`date +%Y%m%d-%H%M`
        sudo mv moodle23 moodle23-$DATE
    sudo mv moodle23-git moodle23
    sudo chown -R _www:_www moodle23
    ## the old folder can be deleted now if you want
    ## sudo rm -R moodle23-*
    ## the next git update only gets the new files
    cd moodle23
    sudo git pull
    cd ..
    sudo chown -R _www:_www moodle23