Installing PEAR 1.9.2 with MAMP 1.9.1 and PHP 5.3.2 on Mac OSX 10.6
This was a lot harder than I think it should have been. I tried following the instructions on the following sites but despite saying that there was “nothing to upgrade” it was still saying version 1.9.0.
http://serverfault.com/questions/184741/upgrading-pear-from-1-9-0-to-1-9-1-fails
http://startrekguide.com/community/viewtopic.php?f=50&t=14728
http://jamsyoung.com/2011/02/11/upgrading-pear-on-mamp/
Using the “go-pear.php” method resulted in the following error:
"Sorry! Your PHP version is too new (5.3.2) for this go-pear."
and using the “pear upgrade pear” method resulted in
"Download of "pear/Console_Getopt" succeeded, but it is not a valid package archive".
At one point I also got the amusing error message saying that it couldn’t upgrade to 1.9.1 because pear/Console_Getopt needed version 1.9.1 to install.
Finally (after installing it in the wrong place twice) I found this method which did work:
Installing Pear 1.9.2
1) Open a new terminal session.
2) Edit your .bash_profile:
edit ~/.bash_profile
so that it contains the following (add it under anything you already have).
PATH="/Applications/MAMP/Library/bin:/Applications/MAMP/bin/php5.3/bin:$PATH"
3) Close terminal and re-open it then type
echo $PATH
It should contain the new MAMP paths. If it doesn’t, something went wrong (make sure you’re in your home directory).
4) Check that you’re running the right PHP (i.e. the one included with MAMP, not the one included in OSX) by typing:
which php
It should read:
/Applications/MAMP/bin/php5.3/bin/php
5) If it says
/usr/bin/php
then you need to either create a symlink to the MAMP version or delete it from here and update your path in your .bash_profile (see above — remember to restart terminal to start a new session).
I backed up the original Snow Leopard versions of PHP and Pear and then deleted them by doing the following:
cd /usr/bin sudo cp php php.bak sudo cp pear pear.bak sudo rm php sudo rm pear
6) Download pear.php.net/go-pear.phar to /Applications/MAMP/bin/php5.3/:
cd /Applications/MAMP/bin/php5.3 curl -O http://pear.php.net/go-pear.phar php go-pear.phar
7) You’ll be asked to set the directories. You only need to set the first one and the rest will be correctly created. Choose “1″ and then type:
/Applications/MAMP/bin/php5.3
Hit return.
8) It will then ask you if you want to update your php.ini. Type “Y” and hit enter.
Once it’s all installed, you’ll see a message saying that you have to update your $PATH variable. If you haven’t already (see step 1), do this now then restart Terminal.
9) Type pear -V and it should now be 1.9.2.
You can then install all the packages you like. Remember that PHPUnit is now on its own channel and you’ll have to make pear aware of that new channel by running
pear channel-discover pear.phpunit.de






