PHP Installation On Mac

Instead of relying on MAMP, XAMP etc., you can configure your Mac to use the latest version of PHP.

MAMP and XAMP doesn’t come with the latest version of php and hence this exercise.

The steps involved are that we need to install:

1. Install Xcode
2. Install XCode Command line tools
3. Install XQuartz
4. Install Homebrew
5. brew install libjpeg
6. brew install pcre
7. brew install libxml2
8. brew install mcrypt
9. brew install libpng

mcrypt is needed for Laravel Framework

To support internationalization, download ICU from

tar xzvf icu4c-4_8_1-src.tgz
cd icu/source
./runConfigureICU MacOSX
sudo make install

Run the following:
./configure \
–prefix=/usr \
–mandir=/usr/share/man \
–infodir=/usr/share/info \
–sysconfdir=/private/etc \
–with-apxs2=/usr/sbin/apxs \
–enable-cli \
–with-config-file-path=/etc \
–with-libxml-dir=/usr \
–with-openssl=/usr \
–with-kerberos=/usr \
–with-zlib=/usr \
–enable-bcmath \
–with-bz2=/usr \
–enable-calendar \
–with-curl=/usr \
–enable-dba \
–enable-exif \
–enable-ftp \
–with-gd \
–enable-gd-native-ttf \
–with-icu-dir=/usr/local \
–with-iodbc=/usr \
–with-ldap=/usr \
–with-ldap-sasl=/usr \
–with-libedit=/usr \
–enable-mbstring \
–enable-mbregex \
–with-mysql=mysqlnd \
–with-mysqli=mysqlnd \
–without-pear \
–with-pdo-mysql=mysqlnd \
–with-mysql-sock=/var/mysql/mysql.sock \
–with-readline=/usr \
–enable-shmop \
–with-snmp=/usr \
–enable-soap \
–enable-sockets \
–enable-sysvmsg \
–enable-sysvsem \
–enable-sysvshm \
–with-tidy \
–enable-wddx \
–with-xmlrpc \
–with-iconv-dir=/usr \
–with-xsl=/usr \
–enable-zip \
–with-imap=/usr/local/imap-2007 \
–with-kerberos \
–with-imap-ssl \
–enable-intl \
–with-pcre-regex \
–with-pgsql=/usr \
–with-pdo-pgsql=/usr \
–with-freetype-dir=/usr/X11 \
–with-jpeg-dir=/usr \
–with-png-dir=/usr/X11 \

I got two errors:

1. configure: error: utf8_mime2text() has new signature, but U8T_CANONICAL is missing. This should not happen. Check config.log for additional information.

To resolve the error you need to compile IMAP.

So I did the following steps:

1. Downloaded the latest version of IMAP from
2. make osx EXTRACFLAGS=”-arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp”
3. sudo mkdir /usr/local/include/
4. sudo cp c-client/*.h /usr/local/include/
5. sudo mkdir /usr/local/lib/
6. sudo cp c-client/*.c /usr/local/lib
7. sudo cp c-client/c-client.a /usr/local/lib/libc-client.a

2. After that I got another error

configure: error: Unable to detect ICU prefix or /usr/bin/icu-config failed. Please verify ICU install prefix and make sure icu-config works.

The error was due to the value of “–with-icu-dir=/usr/” The ICU got installed in /usr/local Directory. So after changing the value to “–with-icu-dir=/usr/local”

The configure command was successful.

Then I ran make and make install for the successful php install/upgrade.


5 thoughts on “PHP Installation On Mac

  1. Hello there, I had exactly the both errors you have had, but since I am using homebrew to solve the first one I just run `brew install imap-uw`. To solve the second one I made as you said. And by the way, thanx!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s