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):

  1. Download the installer “curl http://pear.php.net/go-pear.phar > go-pear.php”
  2. Start the installation “sudo sudo php -q go-pear.php”
  3. Press 1 and “installation base ($prefix)” and change it to /usr/local
  4. Press enter and continue.
  5. Create/copy the default php.ini file “sudo cp /etc/php.ini.default /etc/php.ini”
  6. In /etc/php.ini change the include_path = “.:/usr/local/share/pear”

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