Websites/ OSX Stage Setup

From MozillaWiki
Jump to: navigation, search
This page has been archived and its contents may be out of date.


This setup was conducted on an Intel Mac running OS X 10.5.8 which was the latest version of Leopard at the time of this writing. 10.6 (Snow Leopard) has just come out but, this setup has not been tested on Snow Leopard.


Most of the really big pieces needed to run a site are built in to OS X. The majority of the work to get a development version of running is configuring these things. There shouldn't be any reason why both OS X 10.4 (Tiger) and 10.6 (Snow Leopard) shouldn't also work right out of the box with these instructions and a little coaxing.

Testing this guide on Tiger and Snow Leopard is highly appreciated!

Email me if you find any problems or have any changes to suggest.

Tools Included in OSX

OSX 10.5 comes with Apache 2.0.x
OSX 10.5 comes with PHP 5.2.x

Remember: Turn on Web Sharing to turn on Apache

Need to Install

Collabnet Subversion Binaries 
Simplest and fastest way to get svn running if you don't already have it.
Collabnet Subversion for OSX (Universal Binary 10.4+) Download

Typing into Terminal:

svn --version

Should output the following if you installed SVN correctly:

svn, version 1.6.5 (r38866)
   compiled Sep  5 2009, 10:55:17

Copyright (C) 2000-2009 CollabNet.
Subversion is open source software, see
This product includes software developed by CollabNet (http://www.Collab.Net/). by Patrick Gibson 
An ingenious little time-saver for OSX and Ubuntu that will make a /etc/hosts entry and setup apache in one easy step.


To install merely download and put in ~/Sites/ or somewhere in your path like /usr/bin/

Localhost Installation

Checkout from SVN

cd ~
mkdir src
cd src
svn co

There are over eleven thousand files in the trunk directory so it's gonna take a while. While you wait for that to finish downloading, continue this guide in a new terminal window.

Setup a Virtual Host in Apache

While SVN is downloading, open a new terminal window.

cd ~/Sites

Enter your password and things should look like below.

Create [Y/n]: 
Creating a virtualhost for
+ Adding to /etc/hosts... done
+ Checking for /Users/eman/Sites/ not found
  - Use /Users/eman/Sites/ as the virtualhost folder? [Y/n] 
  + Creating folder /Users/eman/Sites/ done
+ Creating virtualhost file... done
+ Flushing cache... done
+ Restarting Apache... done is setup and ready for use.

Launching virtualhost... done The script tests itself to make sure everything went right. You might have to refresh the browser if it says the host isn't responding.

Symlink Working Directory to Apache Directory

The working directory, ~/src/ has the files that we want Apache to serve up on the domain Apache is expecting that directory at ~/Sites/ so we will make a symbolic link (or symlink) where the code actually is to where Apache expects it to be.

cd ~/Sites/
rm -rf
ln -sv ~/src/ -> /Users/username/src/

Wait for SVN to finish downloading before continuing

Edit <includes/>

Copy the to the right filename.

cd ~/src/

Open the configuration file in your text editor of choice. Find the line with the hostname setting and enter the

$config['server_name'] = '';

Find the line with the file_root setting and enter /Users/username/src/

$config['file_root'] = '/Users/username/src/';

Prime the Feed Parser Pump

cd ~/src/
sudo ./feed-parser.php -c ./feed-parser-config.xml

As is the UNIX way, you know you did it right if the script doesn't say anything.

This is setup to be done manually but, you could schedule a cron job or in the case of OS X 10.5+ (Leopard) by using a launchd script.

Edit the Apache Configuration

Open /private/etc/apache2/virtualhosts/ in your favorite editor or nano.

The virtualhost setup has already done most of the work. We're just going to add some directives from the README file in the root directory.

First, set the server aliases. Even though the README says and * but, that will screw up our local install.

ServerAlias *

Add the rest of the directives from the README

## Directives from the README
AddType application/x-httpd-php .php .html
DirectoryIndex index.php index.html
Options -Indexes

RewriteEngine On
RewriteMap toupper int:toupper
## END README Directives

Comment out all the other things that gave us. Less directives means less things to troubleshoot if something goes wrong. The full Apache conf is below.

# Created Sat Sep  5 17:02:18 PDT 2009
<VirtualHost *:80>
  DocumentRoot /Users/username/Sites/
  ServerAlias *
  ## Directives from the README
  AddType application/x-httpd-php .php .html
  DirectoryIndex index.php index.html
  Options -Indexes
  RewriteEngine On
  RewriteMap toupper int:toupper
  ## END README Directives

  #ScriptAlias /cgi-bin /Users/username/Sites/

  # <Directory /Users/username/Sites/>
  #     Options All
  #     AllowOverride All
  #     Order allow,deny
  #     Allow from all
  # </Directory>

Testing Everything

If everything was setup correctly, should look exactly like


If you have any questions, comments or need help troubleshooting something in this setup, feel free to contact me via email or in IRC freshnice on