Menu

Michael Gracie

Plugging mcrypt into PHP, on Mac OS X Yosemite 10.10

Mavericks rode in on Mountain Lions, but the park ranger at Yosemite wouldn’t let them in. “We need mcrypt” they said, “And we don’t want to recompile PHP!” The ranger handed them a map, and it led them here.

The following instructions are for those a) developing on OS X Yosemite 10.10.X, b) need the capabilities provided by mcrypt during their PHP development (like using PHPMyAdmin or Magento eCommerce), and c) do not want to recompile PHP from scratch or run MAMP. Mcrypt will get loaded dynamically with PHP by following these instructions.

Before you begin, grab the following bits …

1) libmcrypt-2.5.8, which you can find here; download libmcrypt (not mcrypt!), by clicking the link labeled “libmcrypt-2.5.8.tar.gz” on the SourceForge page;

2) PHP 5.5.14 source code, which is available here; NOTE – you may update OS X at some point and PHP may get updated along with it – for the author OS X 10.10 was being run, and PHP 5.5.14 is what’s included with that particular OS version; if necessary use phpinfo() to check your version of PHP and then download the PHP source for that version;

3) Xcode 6.1, which you can get from the App Store. You will also need the Command Line Tools (OS X 10.10) for XCode, which you get by selecting “Xcode/Open Developer Tool/More Developer Tools..” from the Xcode menu, then logging into your Apple Developer account (yes, you need one of those too);

and

4) Homebrew (http://mxcl.github.com/homebrew/) which can be installed by typing ruby -e "$(curl -fsSL https://raw.githubusercontent
.com/Homebrew/install/master/install)" at the command line.

Now for the down and dirty…

(more…)