OS X

PECL on OS X Mountain Lion: Quick and dirty

Yes, this is pretty simple, but I had to look around for too long to find a solution that didn’t involve homebrew or ports or (even worse) some kind of path manipulation to install PEAR/PECL to MAMP. (No, I do not want to set my bash_profile to use the MAMP PHP over the default. And no, I don’t want to recompile PHP – at least not today and at least not until I want to upgrade the version installed.) I just wanted to install pecl_http to run some tests, and I figured if I didn’t put my notes somewhere I would lose them. So here they are.

Before you begin, you need to have Xcode installed – get it from the app store.

Installing PEAR (which includes PECL) is pretty straight-forward (thanks to Jason McCreary at pureconcepts.net)

Two simple terminal commands, and some configuration:

curl -O http://pear.php.net/go-pear.phar sudo php -d detect_unicode=0 go-pear.phar
sudo php -d detect_unicode=0 go-pear.phar

in the configuration prompt –
Type 1 and then Return
then type:
/usr/local/pear

Type 4 and then return and type
/usr/local/bin

Hit return and you are done (with the first part).

Verify pear with:
pear version

Now, before you run off and type sudo pecl install pecl_http you should know that it will fail, as autoconf is not yet installed. Thankfully, this is quite simple as well, (thanks to This question on serverfault.com)

Download the latest release http://ftp.gnu.org/gnu/autoconf/autoconf-latest.tar.gz

Extract the files and do a normal ./configure; make; sudo make install;

Now you can
sudo pecl install pecl_http