Install pear on mac OSX10.7

After upgrading to OSX 10.7, I discovered that both PEAR and PECL had gone. After some considerable searching online Ruggero De Pellegrini on Google+, so I’m putting it here for anyone who needs it (including myself when I get a new mac).

Download the installer "curl http://pear.php.net/go-pear.phar > go-pear.php"
Start the installation "sudo sudo php -q go-pear.php"
Press 1 and "installation base ($prefix)" and change it to /usr/local
Press enter and continue.
Copy the default php.ini file "sudo cp /etc/php.ini.default /etc/php.ini"
In /etc/php.ini change the include_path = ".:/usr/local/share/pear"

Type pecl or pear in Terminal.app and see if it works.