Installing Mcrypt in Mac OS X 10.6.6

posted in: Computers | 0

I need to have PHPMyAdmin running in my MacbookPro (localhost), so PHPMyAdmin was downloaded and copied into webdocs folder for Mac OS X, however PHPMyAdmin needs Mcrypt to be installed. After searching using Google, I found out that the following procedures can be used to install Mcrypt that needed by PHPMyAdmin in Mac OS X environment. Here are the steps that have been used successfully to install Mcrypt in Mac OS X 10.6.6:

mkdir -p /downloads
cd /downloads

curl -O http://surfnet.dl.sourceforge.net/project/mcrypt/Libmcrypt/2.5.8/libmcrypt-2.5.8.tar.gz

tar xzf libmcrypt-2.5.8.tar.gz
cd libmcrypt-2.5.8

MACOSX_DEPLOYMENT_TARGET=10.6 CFLAGS=” -arch x86_64 -g -Os -pipe -no-cpp-precomp” CCFLAGS=” -arch x86_64 -g -Os -pipe” CXXFLAGS=” -arch x86_64 -g -Os -pipe” LDFLAGS=” -arch x86_64 -bind_at_load” ./configure disable-dependency-tracking

make
make install

=== (Next is to build dynamically loaded extension) ===

cd /downloads
curl -O http://www.opensource.apple.com/source/apache_mod_php/apache_mod_php-53.3.1/php-5.3.3.tar.bz2
tar xjf php-5.3.3.tar.bz2
cd /downloads/php-5.3.3/ext/mcrypt
phpize

MACOSX_DEPLOYMENT_TARGET=10.6 CFLAGS=” -arch x86_64 -g -Os -pipe -no-cpp-precomp” CCFLAGS=” -arch x86_64 -g -Os -pipe” CXXFLAGS=” -arch x86_64 -g -Os -pipe” LDFLAGS=”-arch x86_64 -bind_at_load” ./configure

make
make install

When done, edit/create /etc/php.ini and add:
extension=/usr/lib/php/extensions/no-debug-non-zts-20090626/mcrypt.so

Next, need to restart Apache:
sudo apachectl restart

Note: Apple Xcode is needed to be installed and compilation is only for X86,  see “-arch x86_64″config.

Reference: http://discussions.apple.com//thread.jspa?threadID=2713148&tstart=105