装不了PHP的扩展,make install失败

RudonMacBook:igbinary-master rudon$ make install
Installing shared extensions:     /usr/lib/php/extensions/no-debug-non-zts-20131226/
cp: /usr/lib/php/extensions/no-debug-non-zts-20131226/#INST@12567#: Operation not permitted
make: *** [install-modules] Error 1

cp: /usr/lib/php/extensions/no-debug-non-zts-20121212/#INST@17000#: Operation not permitted

原因:

原来是MacOSX 10.11 El Capitan(或更高)新添加了一个新的安全机制叫系统完整性保护System Integrity Protection (SIP),所以对于目录/System /sbin /usr
不包含(/usr/local/)仅仅供系统使用,其它用户或者程序无法直接使用,而我们的/usr/lib/php/extensions/刚好在受保护范围内

解决方法:

禁掉SIP保护机制,步骤是:

  • 重启系统
  • 按住Command + R(重新亮屏之后就开始按,象征地按几秒再松开,出现苹果标志,ok)
  • 菜单“实用工具” >> “终端” >> 输入
$ csrutil disable

执行后会输出:Successfully disabled System Integrity Protection. Please restart the machine for the changes to take effect.
– 再次重启系统
– 禁止掉SIP后,就可以顺利的安装了,当然装完了以后你可以重新打开SIP,方法同上,只是命令是

$ csrutil enable

Thanks♪(・ω・)ノ 感谢你长得那么好看还来看我的博客!see you around ~

00:00/00:00

分类: 小知识

顾北辰

?偶遇故人点头微笑^_^心像透明水滴☝没有喜悲…?

发表回复

您的电子邮箱地址不会被公开。 必填项已用*标注