Make sure you had homebrew. If not yet, head over http://mxcl.github.com/homebrew/ and install it.
Then you need to install: pcre, libjpeg, mcrypt.
brew install pcre
brew install libjpeg
brew install mcrypt
Download PHP5.4 on PHP.net. Extract then come into that folder:
</div> <div>./configure \</div> <div id="LC2">--prefix=/usr \</div> <div id="LC3">--mandir=/usr/share/man \</div> <div id="LC4">--infodir=/usr/share/info \</div> <div id="LC5">--sysconfdir=/private/etc \</div> <div id="LC6">--with-apxs2=/usr/sbin/apxs \</div> <div id="LC7">--enable-cli \</div> <div id="LC8">--with-config-file-path=/etc \</div> <div id="LC9">--with-libxml-dir=/usr \</div> <div id="LC10">--with-openssl=/usr \</div> <div id="LC11">--with-kerberos=/usr \</div> <div id="LC12">--with-zlib=/usr \</div> <div id="LC13">--enable-bcmath \</div> <div id="LC14">--with-bz2=/usr \</div> <div id="LC15">--enable-calendar \</div> <div id="LC16">--with-curl=/usr \</div> <div id="LC17">--enable-dba \</div> <div id="LC18">--enable-exif \</div> <div id="LC19">--enable-ftp \</div> <div id="LC20">--with-gd \</div> <div id="LC21">--enable-gd-native-ttf \</div> <div id="LC22">--with-icu-dir=/usr \</div> <div id="LC23">--with-iodbc=/usr \</div> <div id="LC24">--with-ldap=/usr \</div> <div id="LC25">--with-ldap-sasl=/usr \</div> <div id="LC26">--with-libedit=/usr \</div> <div id="LC27">--enable-mbstring \</div> <div id="LC28">--enable-mbregex \</div> <div id="LC29">--with-mysql=mysqlnd \</div> <div id="LC30">--with-mysqli=mysqlnd \</div> <div id="LC31">--without-pear \</div> <div id="LC32">--with-pdo-mysql=mysqlnd \</div> <div id="LC33">--with-mysql-sock=/var/mysql/mysql.sock \</div> <div id="LC34">--with-readline=/usr \</div> <div id="LC35">--enable-shmop \</div> <div id="LC36">--with-snmp=/usr \</div> <div id="LC37">--enable-soap \</div> <div id="LC38">--enable-sockets \</div> <div id="LC39">--enable-sysvmsg \</div> <div id="LC40">--enable-sysvsem \</div> <div id="LC41">--enable-sysvshm \</div> <div id="LC42">--with-tidy \</div> <div id="LC43">--enable-wddx \</div> <div id="LC44">--with-xmlrpc \</div> <div id="LC45">--with-iconv-dir=/usr \</div> <div id="LC46">--with-xsl=/usr \</div> <div id="LC47">--enable-zip \</div> <div id="LC48">--with-pcre-regex \</div> <div id="LC49">--with-pgsql=/usr \</div> <div id="LC50">--with-pdo-pgsql=/usr \</div> <div id="LC51">--with-freetype-dir=/usr/X11 \</div> <div id="LC52">--with-jpeg-dir=/usr \</div> <div id="LC53">--with-png-dir=/usr/X11</div> <div>--with-mcrypt=/usr</div> </div> <div></div> <div>sudo make</div> <div>sudo make install</div> </div> <div>
You done.