您的位置:首页 > 编程语言 > PHP开发

mac php安装扩展 make install not permit

2017-12-15 19:54 344 查看
装不了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
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: