Installing intl for PHP on OS X

Pecl will only try to install PHP extensions in /usr. But OS X’s security model prevents that. This work-around works around the problem and installs extensions in different spot. This example is for intl, but this method should work for any extension.


pecl download intl
tar -xzf intl-3.0.0.tgz
cd intl-3.0.0/intl-3.0.0/
phpize
./configure --with-icu-dir=/usr/local/opt/icu4c
make -j4
make -j4 test
cp modules/intl.so /usr/local/lib/blah/blah/blah/no-debug-non-zts-20121212/intl.so

Mangle /etc/php.ini and add
extension=/usr/local/lib/blah/blah/blah/no-debug-non-zts-20121212/intl.so

Restart apache and intl’s your uncle.