This is instructions on how to compile and install the phalcon extension on Mac OS X (Lion), along with command-line tools. Everything will be done through the terminal, except installation of Xcode and the command-line tools.
Tested with MAMP 2.1.2/PHP 5.4.4.
I assume that you already have MAMP installed. I am using MAMP 2.1.2 with PHP 5.4.4. You should change the paths throughout the post, to which ever versions of PHP and MAMP you are using. Usually it will just involve changing php5.4.4 to whatever php version you are using.
Xcode
Make sure that Xcode is installed, and also that the command line tools has been installed (Xcode > Preferences > Downloads).
PHP source code
Before you can install the phalcon module, you will need to have the PHP source code at hand (the PHP header files), so phpize works.
Download MAMP_components_2.1.2.zip to your Downloads folder, and extract it. If you are using another version of MAMP, take a look here.
Note: If you can’t find the MAMP components, or just don’t want to download the full package (it is unnecessary if you only need to install this extension), just download the appropriate source file from php.net. The MAMP components image is only infrequently updated, and probably is out of date.
# cd ~/downloads/MAMP_components_2.1.2/
# tar xzvf php-5.4.4.tar.gz
# mkdir /Applications/MAMP/bin/php/php5.4.4/include
# mv php-5.4.4 /Applications/MAMP/bin/php/php5.4.4/include/php
# cd /Applications/MAMP/bin/php/php5.4.4/include/php
# ./configure
autoconf
I had an issue that phpize could not find the autoconf command. So I installed it manually (this was version 2.69, you should change the path to the version you have downloaded).
# cd ~/downloads
# curl -OL http://ftp.gnu.org/gnu/autoconf/autoconf-latest.tar.gz
# tar xzvf autoconf-latest.tar.gz
# cd autoconf-2.69
# ./configure ; make ; sudo make install
automake
I had an issue that the phalcon install script could not find the automake aclocal command. So I installed it manually.
# cd ~/downloads
# curl -OL http://ftpmirror.gnu.org/automake/automake-1.14.tar.gz
# tar xzvf automake-1.14.tar.gz
# cd automake-1.14
# ./configure ; make ; sudo make install
libtool
I had an issue that the phalcon install script could not find the automake libtoolize command. So I installed it manually.
# cd ~/downloads
# curl -OL http://ftpmirror.gnu.org/libtool/libtool-2.4.tar.gz
# tar xzvf libtool-2.4.tar.gz
# cd libtool-2.4
# ./configure ; make ; sudo make install
(You might need to open a new terminal window after this)
phalcon extension
Now we will need to download and install the phalcon extension. The first command is to make sure that php is retrieved from the right location.
# export PATH=/Applications/MAMP/bin/php/php5.4.4/bin:$PATH
# cd ~/downloads
# curl -L -o cphalcon-master.zip https://github.com/phalcon/cphalcon/archive/master.zip
# unzip cphalcon-master.zip
# cd cphalcon-master/build
# sudo ./install
When the phalcon extension has been installed, you enable it in PHP by doing this:
# echo "extension=phalcon.so" >> /Applications/MAMP/bin/php/php5.4.4/conf/php.ini
And that’s the end of it. Restart MAMP and you are ready to go!