Manual:Running MediaWiki on macOS

< MediaWiki User's Guide: Running MediaWiki

The primary development and deployment environment for MediaWiki is on Linux and Unix systems; Mac OS X is a Unix under the hood, so it's fairly straightforward to run it.

I've only tested on 10.2 and 10.3.

Apache
The Apache webserver is included in Mac OS X as "personal web sharing". Turn it on through System Preferences in the Sharing panel. (Security note: by default the included Apache configuration will serve pages to anyone who can open a network connection to your machine. If you have the firewall on, it will punch port 80 open in order to make the web serving public.) You will need to manually edit Apache's configuration later, stay tuned.

MySQL
MySQL should be preinstalled on Mac OS X Server 10.2 or 10.3.

For Mac OS X Client 10.2 or higher, get the install package from http://www.mysql.com/downloads/mysql-4.0.html#Mac_OS_X_Package_Installer

Mac OS 10.2 (jaguar)
On Mac OS X 10.2, you'll need to install PHP. There is an installable package here: http://www.entropy.ch/software/macosx/php/ which I have not tried but should work. [I have and it works. I've installed MediaWiki on Panther. Updating this for more details. --Valluvan]

You can install from source too, of course, if you're a Unix-loving masochist.

Mac OS 10.3 (panther)
On Mac OS X 10.3, PHP is installed by default but not enabled. You need to edit /etc/httpd/httpd.conf and uncomment (remove the preceding #s from) the lines that contain "LoadModule php4_module libexec/httpd/libphp4.so" and "AddModule mod_php4.c". Then open the Sharing panel in System Preferences and stop then restart personal web sharing.

Another method that needs further investigation: uncomment lines in /etc/httpd/users/php.conf

Setting up the database
The only database prerequisite (apart from the installed db) is the root password to login to MySql. The root password is needed for the installation.

Setting up MediaWiki
Get MediaWiki sources from http://sourceforge.net/projects/wikipedia/.

Untar the file in a temporary folder. (It's a good idea to refer to INSTALL document within this folder) Move the directory somewhere web-accessible and go there with your browser. Follow the instructions to install.--Jroes 06:45, 14 Apr 2004 (UTC)

[Can we update below?]

Directory layout
On my machine I've installed them under /Library/MediaWiki like so:

/Library/MediaWiki/wiki.conf A bit of Apache configuration, see below

/Library/MediaWiki/php the *.php files from include/ and languages/ /Library/MediaWiki/cache /Library/MediaWiki/tmp <- temp files for TeX (?) For file cache and TeX temp files (if using). If using, must be writable by the www group.

/Library/MediaWiki/web Here's where the web-exposed stuff will go: wiki.phtml redirect.phtml LocalSettings.php style/ upload/ math/

Using the web installer
(only tested with 1.3.0alpha but it should work for other versions with an in place install) Assuming you have your database setup and a compressed copy of a MediWiki release recent enough to have a web based installer you can install media wiki as follows:
 * 1) Copy the contents of the decompressed archive to your "Sites" folder (which should be in your home directory). You might like to use a subdirectory such as "mediawiki" to make sure your wiki doesn't get mixed in with anything else (these instruction will assume you did this).
 * 2) click on the config directory in the mediawiki folder and type Apple-I (get info) change the directories permissions so that php and apache can edit the contents (you can set it so everyone can read and write this folder but if you do this you must make sure you set it back when you have finished installing)
 * 3) Browse to http://localhost/~short_username/mediawiki/ (where short_user name is your short username) This will redirect you to the installer.
 * 4) Fill in the details it asks for and wait while the installer does its work.
 * 5) In the mediawiki folder there is a directory called "config" open this directory and make a copy of "LocalSettings.php". Put the copy in the MediaWiki directory.
 * 6) Browse to http://localhost/~short_username/mediawiki and you should see a nice new wiki waiting to be populated.

Note: Nothing about security in the above. Needs to be written.

Apache configuration
Create "wiki.conf".

wiki.conf:

Alias /wiki "/usr/local/apache/htdocs/wiki"

 Options Indexes MultiViews FollowSymLinks AllowOverride None Order allow,deny Allow from all 

 AllowOverride None AddType text/plain .html .htm .shtml php_admin_flag engine off 

RewriteEngine on  RewriteRule ^/wiki/en/(.*)$ /wiki/wiki.phtml?title=$1

On 10.3, you can copy or symlink wiki.conf info /etc/httpd/users/. On 10.2 you may need to add this line to the bottom of /private/etc/httpd/httpd.conf:

Include /etc/httpd/users/wiki.conf

That done, restart Apache. Restart it manually to make sure it reports any errors to you:

sudo apachectl restart

(If you restart it from the Sharing panel and there's a config error, it'll just sit there mute. Very annoying.)

You may need to enable PHP also, see the instructions that came with PHP. Make sure that the .phtml extension is assigned to PHP as well as .php; there should be a line like this in the httpd.conf file:

AddType application/x-httpd-php .php .phtml

Security note: unless you've disabled uploads, do not forget to disable PHP in the upload directory.

Mail
To send outgoing mail (inter-user messages and password reminders) a mail server needs to be running.

The mail server on 10.2 is sendmail, but is misconfigured in OS X client and won't run by default. 

On 10.3 postfix is the default mail server; to enable it see

Mac-specific notes
The HFS+ filesystem is not case-sensitive, but MediaWiki is in various places. There conceivably may be problems relating to this.

Next page: Running MediaWiki on FreeBSD >