In order to get PEAR working with MAMP run the following commands.
This may be obvious to some, but you should stop MAMP first. Otherwise you might get some strange errors.
1) Change the directory permissions so you can execute files within them:
chmod 774 /Applications/MAMP/bin/php5.3/bin/pear chmod 774 /Applications/MAMP/bin/php5.3/bin/php
2) Setup an alias to avoid typing the whole path.
Every time you want to access pear you have to type "/Applications/MAMP/bin/php5.3/bin/pear". Typing "pear" referes to what is installed on your mac already and not MAMP's install. (This only apply for the current session. For a more permanent alias see http://clarksco.com/?p=32)
3) Make a link between php5 and php5.3 folders:
Pear gets confused about its version because it installs in both php5.3 and php5 directory
When you upgrade pear it will create a new /Application/MAMP/bin/php5 directory and spread files between php5.3 and php5 folders. Use the code below to make a link between the two file so they act as one. More info about "ln" command. Source: @Marcelo Rodrigo's post
ln -s php5.3 php5
4) Check to make sure pear is working:
5) Now upgrade pear:
mpear channel-update pear.php.net mpear upgrade pear
6) And check again to see if it upgraded pear correctly
Run the following commands:
1) Install PHPUnit:
NOTE: Below I am using "mpear" which is actually an alias I setup in step 2 above. You could simply use "/Applications/MAMP/bin/php5.3/bin/pear" in its place.
mpear config-set auto_discover 1 mpear install pear.phpunit.de/PHPUnit
2) Allow MAMP to use PHPUnit
Link your MAMP's install of phpunit with the default phpunit location.
You may have to run as sudo.
ln -s /Applications/MAMP/bin/php5/bin/phpunit /usr/local/bin/phpunit
3) Make sure it works
For details about installing phpunit check out: