Error configuring mcrypt after upgrading to El Capitan
I am facing the following issue after upgrading to El Capitan. It says:
Installing shared extensions: /usr/lib/php/extensions/no-debug-non-zts-20121212/
cp: /usr/lib/php/extensions/no-debug-non-zts-20121212/#INST@826#: Operation not permitted
while running sudo make install in mcrypt/php-5.6.13/ext/mcrypt folder. I think this is due to SIP but what is the other way round.
What is SIP and how do I know if it's causing this error?
Yes, this is due to SIP. So the two options you have are
- disable SIP entirely
- raise a defect/support request against mcrypt to use
/usr/local
instead of/usr
for installation
After reading @user980575's response (which is a bit redundant with directories) and a comment on Coolest Guide's On The Planet's post regarding this subject (which requires manually editing your ./configure
script) I came up with an alternative solution. Overriding the EXTENSION_DIR
on the fly.
It took a little trial and error but when you're ready to actually perform the install after phpizing (is that a word?) simply make the directory:
mkdir -p /usr/local/lib/php/extensions
And then run:
./configure
make
sudo make EXTENSION_DIR='/usr/local/lib/php/extensions' install
Now that the extension is placed in a non-protected directory you just have to update your php.ini
to point to the extension with the full path.
extension=/usr/local/lib/php/extensions/mcrypt.so
El Capitan adds a new security feature named System Integrity Protection (SIP). Among other things, SIP prevents parties other than Apple from adding, deleting or modifying directories and files stored in certain directories:
/bin
/sbin
/usr
/System
Apple has indicated that the following directories are available for developers to access:
/usr/local
/Applications
/Library
~/Library
All directories in /usr
except for /usr/local
are protected by SIP.
For more information on SIP, please see this post:
https://derflounder.wordpress.com/2015/10/01/system-integrity-protection-adding-another-layer-to-apples-security-model/