*How to install Moodle on the Mac*



*How to install Moodle on the Mac*

Updated 2004.10.31

Apple's OS X is an excellent Unix-type server for Moodle and offers the advantage of many Graphic User Interface (GUI) tools to help do the work for you. In addition, Apache is already installed with all versions of OS X. And PHP/MySQL is installed on the OS X Server edition (however the server edition is very costly (10 clients $499 and unlimited clients $1000) and has its own problems--I recommend the client edition).

Note, these instructions apply when OS X client version is used, not OS X server version. Here are notes of what I and other users have learned over the past year. This is a collaborative, group document, so please add more useful information as you discover it.

The sections below cover...

1. Where to install Moodle on your Mac

2. How to make a fresh Moodle installation onto OS X 10.3

3. How to make OS X upgrades

*1. Where to install Moodle on your Mac*

Put all the moodle site files in your /Library/Web Server/Documents/... folder.

Like this /Library/Web Server/Documents/moodle/

If you would like, you can also put your moodle files into your Sites folder /Users/donhinkelman/sites/

Then put your data files somewhere else, for better security.

Like this: /Users/donhinkelman/moodledata/

*2. How to make a fresh installation onto Mac OS X 10.3*

These instructions were successful on an eMac 1ghz machine on 2004.3.27. Total hardware and software cost was less than USD1000 (800 for the eMac and about 150 for 512MB memory upgrade). Software cost was zero. It should take you about 3 hours.

a. upgrade your Mac OS X version to the most recent one (10.3.5 as of 2004.10.31)

b. change your energy saver default settings. Go to System Preferences and in Energy Saver, move the bar so that the computer and hard disk never sleep (it is OK if the screen sleeps.

c. turn on Personal Web Sharing, FTP, File sharing, etc. in the Sharing preference panel.

d. enable the root user. Go to Utilities >>> NetInfo Manager and click on that single button. Later, you can only access Apache files as the "root" user (you cannot as an "admin" user).

e. download MySQL from Aaron Faby's site

Marc Liyanege's MySQL package is also an option, but actually it is just a download from the main MySQL site and has complicated modifications (for me ( ) to do by command line. Aaron Faby's version includes a GUI installer and a good install manual. After adding a preference pane (be sure to make a folder called "PreferencePane") you can start and stop MySQL from your System Preferences. After setting that up, enable the "MySQL root user" and give it a password (not to be confused the the "system root user"). Write down the user name ("root") and password you give it (you will need this later when you set up PHPmyAdmin). Restart your computer and see if you see the database "running" in the preference pane.

note (2004.6.21): I have had a small problem with the ServerLogistics Apache2 package. It works fine, but does not restart upon reboot. Also occasionally this Apache2 server stops and I must do a graceful restart to get it going again.

e. download PHP

from Marc Liyanage's site

or from Aaron Faby's site

(updated August 2004)

These are an excellent versions of PHP that are completely designed for Mac OS X and includes the latest GD Library (essential for Moodle to show face photos). Apple often includes PHP in its OS, but as of version 10.3.3, many developers report that it is inferior and is missing many modules including GD. Installation is simple. Just download the entropy PHP, click install and it will overwrite all old PHP builds and even update your Apache files to "activate" PHP (Apple's Apache has PHP turned off). Only use Aaron Faby's () Complete PHP if you plan to use it together with Complete Apache2. This version now has a PHP Accelerator included within its package--a big plus. It is called TurckMMCache and it is reported to increase PHP speed 4-10 times. Martin recommends using a PHP accelerator in any server for Moodle. Recently a bug with Moodle and TurckMMCache was fixed so I can now recommend going with the Complete PHP/MySQL/Apache2 combination. If you want to stick with Apple's Apache, the Entropy packages are better because they continue using the old but stable version of Apache1 included in OS X.

f. download PHPMyAdmin or YourSQL and make an empty database

Moodle already has a version of PHPMyAdmin as an addon module. However, before installing Moodle, you have to make an empty database, called "moodle". I have tried numberous free software to create a database, but was only successful with PHPMyAdmin and YourSQL. Download either of them (YourSQL is more intuitive) and configure a "connection" to your MySQL server. Be sure to remember the MySQL user name and password. Once PHPMyAdmin is working from a web browser, just create that one database (no tables or fields) called "moodle". Then you can forget about this software.

Alternatively, creating a database can also be done from the Terminal Application (found in =/Applications/Utilities/=). Start terminal and navigate to your mysql directory by entering cd commands to arrive at =/usr/local/mysql/bin/= You need to start MySQL before creating a database. To do this, you need to be at "Root" level, so at the prompt type the two letters "su". You will be asked for your computer password, and entering it will give you a new prompt of root# where you can now start MySQL by typing: mysqld_safe & You should get a message "Starting mysqld daemon with databases from =/Library/MySQL/var= " Email mstevens at aus.ac.ae if you are stuck here. If MySQL is running, and you are in the same directory (=/usr/local/mysql/bin/= you can type "sudo echo hi". This may ask for your computer password, or just say hi to you :). Now, you can type, "mysql -u root -p" which will take you to the mysql monitor which has a prompt of "mysql>". From here you can create your Moodle database by typing: CREATE DATABASE moodle; The semicolon at the end is vital. If successful, you should read, "Query OK, 1 row affected (0.18 sec)" or something similar. Type "exit" and you are done.

g. download Postfix Enabler, Cronnix and Tinkertool.

These are free GUI tools to help you finish the installation according to the Moodle Installation Manual. Go to or to find these. See more info below in the upgrading instructions.

h. put the downloaded moodle folder in Webserver Documents and run "Administration".

You will see many screen messages. If all of these are successful, you have finished your job. Congratulations.

*3. Mac OS X 10.3 Upgrade Report*

On 9 February 2004, I upgraded my Moodle 1.1.1 server from Mac OS X 10.2.6 to Mac OS X 10.3.2. First, I used the Upgrade Option on the Panther install disk to go to 10.3 and then used Software Update to go to 10.3.2. (Note: I read too late that 10.3.1 runs faster for servers than 10.3.2--but I upgraded already). In my case, I had no problems with Upgrade, and it saved me so much time. Some people advise doing Clean Install, however, that was advisable going from 10.1 to 10.2. Going from 10.2 to 10.3, I have read that it not necessary to do a clean install.

After the upgrade, all the settings below had to be redone. First, I had to reedit the Apache httpd.conf file which had been overwritten. This is a hidden file (I edited it as root user using BBEdit Lite) in the /private/etc/httpd/... folder. Also, Tinkertool can be used to make hidden files appear in the finder windows. Here are my notes on editing this file. Non-japanese oriented sites can ignore my language settings. I also noticed that the entropy version of PHP 4.3.4 also automatically updates the Apache settings below in the httpd.conf file (except for language modifications).

*a. httpd.conf editing* _(on 2004.2.9, after upgrading to Mac OS X 10.3 and 10.3.2)_

Uncomment these lines to activate PHP:

LoadModule php4_module libexec/httpd/libphp4.so

AddModule mod_php4.c

Change the Directory Index line to...

DirectoryIndex index.php index.html index.htm

For Japanese language users, here are three other changes you might try….

1) Add this line after AddLanguage ja.ja

AddCharset EUC-JP .euc-jp

2) Change the Language Priority line to fit your needs... I put "ja" first.

3) Add this line after Language Priority

AddDefaultCharset EUC-JP

Add the following two lines after AddType application/x-tar.tgz (I forgot why but it was in my old version...)

AddType application/x-httpd-php .php

AddType application/x-httpd-php-source .phps

*b. Enable Postfix*

Postfix is the internal Unix program to send mail automatically. Sendmail is no longer used as of OS version 10.3. However, Postfix is dormant and you need to enable it. You can do this on the command line but an easy GUI way is to download "Postfix Enabler" at This is for OS X 10.3 (ordinary, non-server version only). In Postfix Enabler, you just click the "enable" button and then go into your Mail application to set the SMTP mail server as "localhost". For command line info go to...

If your ISP uses SMTP, after enabling Postfix you need to click on Postfix's "Send Mail" tab and enter information for Administrator, Masquerade, Smart host, and probably enable SASL authentication as well. The Readme button will explain the values in these fields.

*c. Reset Cron*

Also, I was reminded to check if cron was working. To do that, I downloaded Cronnix, a GUI interface for editing the crontab in Mac OS X. In Cronnix, I set the command to:

*/5 * * * * /usr/bin/curl -s -o /dev/null http ://myservername/moodle/admin/cron.php

as per Martin's suggestion. (note: omit the space after the "http" above)

This can also be done in the Terminal Application. At the command prompt, type: "crontab -e". Usually, the "crontab" command will put you into the 'vi' editor. You enter "insert mode" by pressing "i", then type in the line as above, then exit insert mode by pressing ESC. You save and exit by typing ":wq", or quit without saving using ":q!" (without the quotes).

*d. Setup GD*

This depends on the PHP version. I had installed PHP a long time ago and noticed GD was not installed, so with a little research, I found I needed to upgrade my version of PHP. I have heard that Apple's installed version of PHP does include GD library. I went to Marc Liyanage's site entropy.ch and downloaded his recent PHP version 4.3.4 for the Mac. As of October 2004, PHP version 5 is available from Marc. His version includes the GD library. Also, Jay Neal reminds us to "be certain to double check ownership of the user directories under your moodledata folder that resides outside of Documents. I had problems initially because "www" was not listed as read and write. "nobody" as owner didn't work for me under 10.3."

*Upgrade from 10.3.2 to 10.3.3* _2004.3.22_

I upgraded from the Software Updater and after restart, Moodle worked OK. Later I upgraded to Moodle 1.2 Final. Operation seemed slow during a workshop with ten teachers setting up courses. Later I checked my settings and found that the Apache httpd.conf settings had commented out both …

LoadModule php4_module libexec/httpd/libphp4.so

AddModule mod_php4.c

This is puzzling. I wonder if the Apple upgrade did this or if the PHP upgrade (to 4.3.4 entropy version) did it. I uncommented those two lines. I cannot tell yet if that had any effect on operation. I also discovered that my Carbon Copy Cloner stopped operating on February 9th after my upgrade from OS 10.2 to 10.3. I reconfigured CCC and it is running again.

*Server Crashes on Simultaneous Overloading*

On 2004.4.5 we used the above Mac Moodle server to administer a 50 question placement test with 30 audio questions to 163 students in a computer lab. Everything slowed to a crawl and some machines crashed with database errors reported. We found that Apache settings were the crash problem and suspect other PHP and MySQL settings may be poorly tuned. More report coming.

On 2004.4.25 we switched to a Dual 1.2ghz Power Mac. This worked faster than the 933mhz Powermac but was still not sufficient for 100+ simultaneous users (however 1000+ occasional users is fine). We also had two other problems with this server. 1) random freezes which have been reported on MacIntouch. 2) Finder consumes 100% of CPU. This one is puzzling. It requires a logout or reboot to release the finder. Due to this unreliability, we have decided to switch to a Linux server in the coming months. Another user reports “1300 active users and roughly 50 courses (average 3000+ logs a day) running on a dual 1.8 ghz G5 without any problems. OSX 10.35, Apache 1.3, php 5.01 (Lyanage) and MySQL 4 work great together.”

Contact me if you have questions: Don Hinkelman Please add notes here as you discover more information.

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download