Installing PHPUnit with MAMP’s PEAR installer is pretty straightforward, but there are a few things to note:

  1. Everything will be done through Terminal, so go ahead and launch it now. All of the commands I give can be copied and pasted as they are.
  2. Make sure you’re using the version of PEAR that came with MAMP, not the version that came with your Mac. This means we have to use /Applications/MAMP/bin/php5/bin/pear at the prompt, not pear.
  3. PHPUnit 3.4 requires PHP 5.1.4 or later, but PHP 5.3.2 or later is recommended. MAMP 1.8.2 (the version I have installed) is running version 5.2.10. The latest version of MAMP includes version 5.3.2. So far, I haven’t noticed any problems running PHPUnit under 5.2.10.
  4. PHPUnit also requires PEAR 1.8.1. MAMP 1.8.2 ships with version 1.8.0. To check which version you have installed, type
    /Applications/MAMP/bin/php5/bin/pear -V.

If you need to upgrade PEAR, first use the following two commands:
/Applications/MAMP/bin/php5/bin/pear channel-update pear.php.net
/Applications/MAMP/bin/php5/bin/pear upgrade pear

Now, it’s time to install PHPUnit. The PEAR channel used to distribute PHPUnit needs to be registered with the local PEAR environment, and a component that PHPUnit depends upon is hosted on the Symfony Components PEAR channel. To register the channels and install, simply type:
/Applications/MAMP/bin/php5/bin/pear channel-discover pear.phpunit.de
/Applications/MAMP/bin/php5/bin/pear channel-discover pear.symfony-project.com
/Applications/MAMP/bin/php5/bin/pear install phpunit/PHPUnit

PHPUnit is now installed, but to get it to run from Terminal, we need to move it into our $PATH. To do so, type:
mv /Applications/MAMP/bin/php5/bin/phpunit /usr/local/bin/phpunit.

To test your install, type:
phpunit --version.

You should see something like PHPUnit 3.4.15 by Sebastian Bergmann. And that's it!

  1. Stop MAMP (/Applications/MAMP/MAMP.app)
  2. Open MAMP's httpd.conf in a plain text editor (/Applications/MAMP/conf/apache/httpd.conf).
  3. Find the line
    DirectoryIndex index.html index.php
    and change to
    DirectoryIndex index.shtml index.html index.php
  4. Uncomment the following two lines:
    AddType text/html .shtml
    AddOutputFilter INCLUDES .shtml
  5. Find the lines
    <Directory />
    Options Indexes FollowSymLinks
    AllowOverride All
    </Directory>
    and change to
    <Directory />
    Options Indexes FollowSymLinks
    Options +Includes
    AllowOverride All
    </Directory>
  6. Restart MAMP

Firebug extensions

As Jan Odvarko notes, "I was surprised how many Firebug extensions … exist out there." Check out his list of 12 extensions at http://www.softwareishard.com/blog/firebug/list-of-firebug-extensions/. All extensions include a brief summary of what they do, a screen capture and a link to the download page.

Two that I use are YSlow and Odvarko's own Firecookie.. YSlow analyzes Web pages and determines why they're slow based on Yahoo's rules for high performance web sites. Firecookie makes it possible to view and manage cookies within the familiar Firebug UI.