You can install the mcrypt PHP extension with homebrew
and use it with the standard PHP installation that comes with OS X.
Install mcrypt:
brew install mcrypt
Install the php extension -- this installs the whole php 5.5, but you can still use the system-provided one by default
Note: install the version compatible with whatever your OS X PHP version currently is (check with php -v
)
brew install homebrew/php/php55-mcrypt
The mcrypt shared library should now be installed in /usr/local/Cellar/php55-mcrypt/5.5.30/mcrypt.so
.
The PHP settings file is /private/etc/php.ini
. If you don't have said file, copy contents from php.ini.default
in the same directory as your php.ini
.
Find the Dynamic Extensions
section of the php.ini
file and add the following line to it:
extension=/usr/local/Cellar/php55-mcrypt/5.5.30/mcrypt.so
After this, you should have mcrypt
installed and enabled in PHP (check with php -m
-- mcrypt
should be listed among the modules.
I found following this guide to help:
https://coolestguidesontheplanet.com/install-mcrypt-for-php-on-mac-osx-10-10-yosemite-for-a-development-server/
Just replace the php version with the version you are running
php -v
This works with High Sierra