Mihai Irodiu
Developer @ WPR
November 28, 2016

How to compile IMAP with SSL for PHP on OSX – works on MAMP as well

This tutorial is an attempt to alleviate the headaches for all those that need to have IMAP with SSL running on OSX 😃

Needed stuff

imap2007 install with brew “brew install imap-uw”
download from https://www.mirrorservice.org/sites/ftp.cac.washington.edu/imap/ (the archive without Z at the end ) imap-2007e
To install libxml2, you can use brew: brew install openssl libxml2 mcrypt
To link openssl to libxml2: brew link openssl libxml2 –force
See screenshot below:



Download map-2007e, unzip and run with terminal
make osx EXTRACFLAGS="-arch i386 -arch x86_64 -g -Os -pipe -no-cpp-precomp” 
it will create a folder c-client and might give a few warning, if it’s not fatal error, go on
use the following commands after running the command and the folder c-client is created
sudo mkdir -p /usr/local/include
sudo cp c-client/*.h /usr/local/include/
sudo mkdir /usr/local/lib
sudo cp c-client/*.c /usr/local/lib/
sudo cp c-client/c-client.a /usr/local/lib/libc-client.a
Now, download the version of PHP you require ( the one you use in MAMP )
– go to /Applications/MAMP/bin/php/<your_php_version> and create the folders /include/php/
– extract the php files there
– open terminal in that folder and run
cd ext/imap
./configure --with-imap=/usr/local/imap-2007 --with-kerberos --with-imap-ssl=/usr/
./configure –with-imap=/usr/local/imap-2007 –with-kerberos –with-imap-ssl=/usr/ fails
imap-2007f = depends on which one you installed
/Applications/MAMP/bin/php/php5.5.26/bin/php-config path to your php from MAMP for which you need the map with SSL
env LDFLAGS=”-lssl -lcrypto” ./configure –with-imap=/usr/local/imap-2007f –with-kerberos –with-imap-ssl –with-php-config=/Applications/MAMP/bin/php/php5.5.26/bin/php-config
if needed for –with-imap-ssl do –with-imap-ssl=/path_to_folder_that_contains evp.h file

Now pray 🙂 

If your prayers have been answered, go to the extracted php files, go to folder ext/imap/modules/ and copy map.so and map.la to

Tutorials that do not work from end to end, but they are worth mentioning as they provided useful information:

This was address further up. Simply swap out:

./configure --with-imap=/usr/local/imap-2007f --with-kerberos --with-imap-ssl


LDFLAGS="-lssl -lcrypto" ./configure --with-imap=/usr/local/imap-2007f --with-kerberos --with-imap-ssl

Relax and enjoy 🙂

Now drop us a line in comments and let us know if you’ve managed to make it work for you or if you still have issues.

Entrepreneurs usually struggle to create their online platforms when they don’t have a technical partner. It’s confusing and overwhelming.
We have a 5-step process that makes it easy and helps them avoid all the traps. In just 60 days, your web platform is set up and they can start making money.
Send us your project idea and get a free 5-minute review.
Want a beautiful website or plugin?

Leave a reply

Your email address will not be published.

Your email address will not be published. Required fields are marked *

Want More Amazing Stories?
Sign up now and get the best business as well as technical advice on how to run your WordPress powered business:
  • This field is for validation purposes and should be left unchanged.