在OS X Yosemite上安装mcrypt

Im trying to run a application on a local dev. enviorment on OS X Yosemite, but it fails due to mcrypt no being enabled.

I started with this guide: https://coolestguidesontheplanet.com/install-mcrypt-php-mac-osx-10-10-yosemite-development-server/

AndI have gone trough every guide i can find.

In my php.ini file I have added the extensions:

; Directory in which the loadable extensions (modules) reside.
; http://php.net/extension-dir
; extension_dir = "./"
; On windows:
; extension_dir = "extension_dir=/usr/lib/php/extensions/no-debug-non-zts-20121212/mcrypt.so"
; extension=mcrypt.so

If use command:

php --info | grep mcrypt\\.


Additional .ini files parsed => /usr/local/etc/php/5.5/conf.d/ext-mcrypt.ini
Registered Stream Filters => zlib.*, bzip2.*, convert.iconv.*,   string.rot13, string.toupper, string.tolower, string.strip_tags,   convert.*, consumed, dechunk, mcrypt.*, mdecrypt.*
PHP Warning:  Unknown: It is not safe to rely on the system's timezone settings. You are *required* to use the date.timezone setting or the date_default_timezone_set() function. In case you used any of those methods and you are still getting this warning, you most likely misspelled the timezone identifier. We selected the timezone 'UTC' for now, but please set date.timezone to select your timezone. in Unknown on line 0
mcrypt.algorithms_dir => no value => no value
mcrypt.modes_dir => no value => no value

Not sure what to do now.

It's easy if you can use Homebrew. Run the following command from your Terminal.

brew install autoconf
brew install mcrypt

Restart Apache

sudo apachectl restart

See this answer for other available methods.

If you installed mcrypt using homebrew and the module is still not showing in your phpinfo(), you can try the following which works for me (OS X Sierra):

Edit your php.ini (you can use vi or nano instead of atom)

sudo atom /etc/php.ini

Add the following line at the end of your php.ini (your encrypt version maybe different)

extension="/usr/local/Cellar/php56-mcrypt/5.6.29_3/mcrypt.so"

Restart apache

sudo apachectl restart