Patrick Ward words, code, and music

Installing PHPUnit With MAMP 2.0.1

I needed to install PHPUnit with my local version of MAMP Pro 2.0.1 recently. After starting with this article for ideas, I came up with the following adjusted steps:

1. Create a soft link to the MAMP version of pear:

ln -s /Applications/MAMP/bin/php/php5.3.6/bin/pear \
/usr/local/bin/pear

2. I found that the default pear.conf file was either corrupt or invalid. Following a forum suggestion on the mamp.info site, I just removed it by renaming it:

mv /Applications/MAMP/bin/php/php5.3.6/conf/pear.conf \
/Applications/MAMP/bin/php/php5.3.6/conf/pear.conf.bak

3. Add the pear channels associated with PHPUnit:

pear channel-discover pear.phpunit.de
pear channel-discover pear.symfony-project.com
pear channel-discover components.ez.no

4. Install PHPUnit:

pear install phpunit/PHPUnit

Note: I ran into a an issue at this point, where pear would not install an unstable version of HTTP_Request2 that it found. So, I just forced it to install the RC1 version instead:

pear install -f HTTP_Request2-2.0.0RC1

I ran the pear install command after this.

5. At this point, PHPUnit should be installed. So, I created a new soft link to the phpunit file:

ln -s /Applications/MAMP/bin/php/php5.3.6/bin/phpunit \
/usr/local/bin/phpunit

6. Done. To test the install type:

phpunit --version