Compiling intl extension for MAMP (Symfony2)

When your developing a symfony app, sooner or later you'll have an error telling you that you require to install the intl extension for PHP. As i've had this issue today, i have searched an awefull lot about how to install this correctly on MAMP (pro), and couldn't seem to find a solution that actually worked. After trying a lot of different solutions, this one worked.

MAMP

Step 1: install ICU

Download, compile & install ICU (source code). After downloading and unpacking the package (to your downloads folder) you can use following terminal commands:

cd ~/Downloads/icu/source 
./runConfigureICU MacOSX
make
make install

Step 2: Install Intl

first you'll need to download & extract the php source code here (note that you'll need to download the version you're currently using in MAMP.) after extracting the source code, you can run following commands (i'll use 5.4.4 as demo in this code, you'll need to change this number in the commands to the version you're using.):

export PATH=/Applications/MAMP/bin/php/php5.4.4/bin/:$PATH
cd /Applications/MAMP/bin/php/php5.4.4
mkdir include
mv ~/Downloads/php-5.4.4 include/php
cd include/php
./configure
cd ext/intl
phpize
./configure
make
make install

Step 3: Edit php.ini

In order to let php know to use the intl extension you'll need to edit the php.ini file. This file can be found in the following directory:

/Applications/MAMP/conf/php5.4.4/php.ini

You'll need to add the following line in the file:

extension=intl.so

After that restart Apache, and you're good to go!