web development

Installing PHPUnit on MAMPs

After spending sometime searching on how to it. I just want to document what worked for me.

My setup MAMPs version 2.1.1 , php version 5.4.4, pear version 1.9.4

sudo /Applications/MAMP/bin/php/php5.4.4/bin/pear config-set auto_discover 1
sudo /Applications/MAMP/bin/php/php5.4.4/bin/pear install pear.phpunit.de/PHPUnit

Now you should be able to do

require_once 'PHPUnit/Autoload.php';

To make it available on the command line everywhere you need to create a simlink to phpunit in your local bin.

sudo ln -s /Applications/MAMP/bin/php/php5.4.4/bin/phpunit /usr/local/bin/phpunit
phpunit --version
Standard