Here is a quick and solid way to add PHPUnit to your MAMP Setup
The path to your PHP and PEAR if you are using MAMP is something similar to this
/Applications/MAMP/bin/php/php5.xxx/bin/php
/Applications/MAMP/bin/php/php5.xxx/bin/pear
notice the php5.xxx this will depend on the version of php you are using, in my case is php5.3.6 so have that in mind if you are planning on copy pasting this guide
/Applications/MAMP/bin/php/php5.3.6/bin/pear config-set auto_discover 1
As Alex from the comments states you might need to update pear
cd /Applications/MAMP/bin/php/php5.3.6/bin
sudo ./pear upgrade pear
/Applications/MAMP/bin/php/php5.3.6/bin/pear install pear.phpunit.de/PHPUnitThis will install PHPUnit under/Applications/MAMP/bin/php/php5.3.6/bin/phpunitsudo ln -s /Applications/MAMP/bin/php/php5.3.6/bin/phpunit /usr/local/bin/phpunitI always try to keep my binaries and executables under /usr/local/bin but this is my choice you can try some other directory as long as you have it exposed on via your EXPORTS
If you installation of PHPUnit doesn’t work it is most likely because pear is out of date.
Just run:
cd /Applications/MAMP/bin/php/php5.3.6/bin
sudo ./pear upgrade pear
before step 1 of the instructions to be safe.
This was my case under Lion with MAMP PRO 2.0.5 installed.
Thanks Alex, I’ll update