mac php安装扩展 make install not permit

来源:互联网 发布:微医挂号网可靠吗 知乎 编辑:程序博客网 时间:2024/06/05 09:09

装不了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


原因:

原来是OSX 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


原创粉丝点击