If you look at the coolest rails on the planet separately for mcrypt, they suggest disabling SIP. But there is a way around this. Follow the instructions as usual (skipping the SIP part), and after running /usr/bin/phpize you can override the make extensions directory.
First create a new home for php extensions:
mkdir -p /usr/local/lib/php/extensions
Then run:
./configure make sudo make EXTENSION_DIR='/usr/local/lib/php/extensions' install
And finally, when you add the extension to your php.ini , the easiest option is to include the full path to the file.
extension=/usr/local/lib/php/extensions/mcrypt.so
So far this works for me.
Indirect links:
Mcrypt configuration error after upgrading to El Capitan (Ask Different)
Commentary by John Gardner, who started me on my way
source share