How To Install PEAR in Mac OS X Leopard

Unlike previous version of OS X, Leopard doesn’t come with PHP’s PEAR repository installed by default. Luckily, installing is quick and painless.

From a command line:

curl http://pear.php.net/go-pear > go-pear.php
sudo php -q go-pear.php

(Just press enter to select all the default choices.)

Next we need to modify our php.ini file to include the new PEAR files:

sudo cp /etc/php.ini.default /etc/php.ini

Edit /etc/php.ini and change

;include_path = “.:/php/includes”

to read

include_path = “.:/usr/share/pear”

Restart Apache and you’re done!

[Adapted from http://clickontyler.com/blog/2008/01/how-to-install-pear-in-mac-os-x-leopard/]

3 Responses to “How To Install PEAR in Mac OS X Leopard”

  1. Rimian Says:

    Is this line correct? Seems like a hard paragraph break is missing:

    curl http://pear.php.net/go-pear > go-pear.phpsudo php -q go-pear.php

  2. Ian Munday Says:

    Yes, you’re are quite right – thank you. I’ve now corrected this.

  3. zack Says:

    got a problem with the default install directories for PEAR – is installing to : /Users/me/PEAR /private/var/root/PEAR

    .I’ve searched everywhere.. I just don’t get it!!

    please help! :)


Leave a Reply