Installing runkit on MAMP and Mavericks

The problem

I need to use runkit to work some magic during tests and, running MAMP as my local server stack, I do not have it built-in and ready.
Trying to use the command

pecl install channel://

Will generate an error while trying to include the php.h file.
To run runkit in my code I need a version of it compiled on my system (Mavericks) and for my PHP version.
The combination of the two is not anywhere I can find on the web so I need to build it from source.

Works on other versions too I guess

Since my solution involves building PHP from source it should work on other Mac and PHP versions too. In the examples I will use PHP version 5.3.27 but any version will do.

Install Xcode

Available for free on the AppStore I install it and that’s done. In earlier versions Command Line Tools had to be manually downloaded but in Maverick version those seem to be installed by default so one less step.

Add the version of php, pear and pecl that comes with MAMP to the path

I do this to be able to invoke any one of the three above commands without having to specify the full path to MAMP nested folder. Using any text editor I simply tell my machine, a Mac, to look for php, pear and pecl in MAMP folder before resorting to the versions that came bundled with Mavericks.

// file ~/.bash_prfile

export PATH=/Applications/MAMP/bin/php/php5.3.27/bin:$PATH

Download, position and configure PHP source

MAMP is shipped as ready to run and hence will not come with the source files to build PHP from scratch. I need those and a quick Googling turns out the source for my PHP version of choice.
After the downloading it I position the folder containing the extracted files, named in my case php-5.3.27, in MAMP

mv ~/Downloads/php-5.3.27 /Applications/MAMP/bin/php/php5.3.27/includes/php

Please note that there is an implicit renaming of the folder too: from php-5.3.27 to php.
After this I cd to the just moved folder and run configure

cd /Applications/MAMP/bin/php/php5.3.27/include/php; ./configure

Download, configure and build runkit

I use zenovich’s version of runkit and, after downloading it to the Desktop build it with the chained commands

cd ~/Desktop/runkit-master; phpize; configure; make

The prize is now located in the modules folder and I will copy it to the MAMP extension folder

cp ~/Desktop/runkit-master/modules/ /Applications/MAMP/bin/php/php5.3.27/lib/php/extensions/no-debug-non-zts-20090626/

This is the default folder MAMP will look into for extensions and will make any file in it available in code. MAMP is already configured to look into the folder for modules but wil not load them.

Load runkit at code time

I can now call runkit using the dl('') instruction in place of adding it to the default loaded extensions MAMP will load each time. In any case the way to this second option is to add a line to the php.ini file of the used PHP version like this

; Dynamic Extensions ;
; If you wish to have an extension loaded automatically, use the following
; syntax:
;   extension=modulename.extension
; For example, on Windows:
;   extension=msql.dll
; ... or under UNIX:
; Note that it should be the name of the module only; no directory information 
; needs to go here.  Specify the location of the extension with the
; extension_dir directive above.

; Extensions

; add runkit

I appreciate your input