I am following this tutorial: http://coolestguidesontheplanet.com/install-mcrypt-php-mac-osx-10-10-yosemite-development-server/

So far it's been great. I have just got to the heading: Compile mcrypt php Extension

When I run /usr/bin/phpize

I get this output:

grep: /usr/include/php/main/php.h: No such file or directory
grep: /usr/include/php/Zend/zend_modules.h: No such file or directory
grep: /usr/include/php/Zend/zend_extensions.h: No such file or directory
Configuring for:
PHP Api Version:        
Zend Module Api No:     
Zend Extension Api No:

I am using PHP 5.5.14 and downloaded the equivalent PHP language in the tutorial. How would I fix this?

  • I would like to add, that I recently started using Homebrew and it was so much easier and saved me hours to get up and running. I hope this is useful to those who don't want to use Homebrew. But also informative for those who don't know about Homebrew yet or aren't sure whether to use it.
    – Jonnny
    Jan 15, 2015 at 17:42

4 Answers 4


After a bit of a rathole with this answer originally, revealed in comments it becomes apparent you have executed /usr/bin/phpsize instead of your PHP 5.5.14 version of phpize which supplies configuration files for compiling, in this case mcrypt.

Instead of executing /usr/bin/phpize following the tutorial script you should have invoked your 5.5.14 phpize in the mcrypt directory (see the tutorial Compile mcrypt php Extension).

The idea is that the include tree for matching the PHP version reflected in `/usr/bin/phpize is not installed, it's dependent on having the command line developer tools installed. The presence of the installed version of PHP's include tree doesn't appear to be necessary if you're actually using a different version of PHP, which will have been installed (somewhere) with the required include files.

Use of the correct phpize should straighten out the mcrypt build. If you check the man page you could first execute phpize --clean to remove any incorrect setup first.

You could also note that the developer command line tools are necessary to build mcrypt whose source is written in C. This does not imply or require the use of Xcode.

  • thanks David. Does that mean taking the link I was using and rather than using terminal. Use the Xcode console? I don't have much experience with macs.
    – Jonnny
    Oct 19, 2014 at 6:49
  • Hi David, Sorry, I'm still a little confused as to how to fix this. I have the developer tools and xcode. Which files am I looking for in the xcode contents package I assume?
    – Jonnny
    Oct 19, 2014 at 14:38
  • Ok, I think I may have found out my problem here, does this seem plausible. I had the new Xcode + developer tools on Maericks and I had set my system PATH to use a newer PHP version, not the one that was with Mavericks. So my include folder is actually in my other PHP 5.5.11 folder. When I got Yosemite I already had XCode + Dev Tools and at the time of download still had the older 5.5.11 PATH. so new PHP 5.5.14 my/usr/bin/php has no include folder. Can I just copy the contents from the other PHP include folder across or should I uninstall Xcode and reinstall?
    – Jonnny
    Oct 19, 2014 at 20:57
  • Thanks for your help. In the end I copied the include file over and managed to compile. Appreciate your time
    – Jonnny
    Oct 20, 2014 at 2:09

Just add symbolic link for php headers directory:

sudo ln -s /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10.sdk/usr/include/php /usr/include/php

and then run phpize.

  • It worked for me with El Capitan as well. I just needed to change ../MacOSX10.11.sdk/..
    – shinokada
    Dec 27, 2015 at 2:54
  • This will not work for MacOs Catalina. Nov 8, 2019 at 9:28

Yes I had to do this first:

cp /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.10sdk/usr/include/php /usr/include/php

I encountered the same phpize problem when following the same tutorial. What I did is install the Xcode command line tools, rather than "Get" Xcode after running "xcode-select --install".

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .