在搭建 PYQT 的过程中我遇上了一个非常恶心的问题,在安装 sip 的时候编译源代码之后的安装过程中一直提示我:Operation not permitted ,我甚至重装了系统也无济于事,终于通过查资料攻克了问题。

安装 sip

下载 sip 源代码包解压之后进入它的文件夹下:

python configure.py
sudo make
sudo make install

这时出现了一个非常恶心的报错提示:

cp -f sip /System/Library/Frameworks/Python.framework/Versions/2.7/bin/sip
cp: /System/Library/Frameworks/Python.framework/Versions/2.7/bin/sip: Operation not permitted
make[1]: *** [install] Error 1
make: *** [install] Error 2

于是乎,我用 su 登录 Shell。在反复以上过程,无果。

之后,我又使用 brew install sip,报相同的错误。

然后我又进入 /System/Library/Frameworks/Python.framework 文件夹打算一探到底:

试图改动它的权限。结果:

原因

经历了XCode编译器代码被注入的事件后,这次 Mac OS X El Capitan系统的升级,启用了更高的安全性保护机制:系统完整性保护System Integrity Protection (SIP)。简单来讲就是更加强制性的保护系统相关的文件夹。开发人员不能直接操作相关的文件内容。

苹果官方给出的解释:

System Integrity Protection is a security technology in OS X El Capitan that’s designed to help prevent potentially malicious software from modifying protected files and folders on your Mac.

In OS X, the “root” user account previously had no permission restrictions and could access any system folder or application on your Mac. Software gained root-level access when you entered your administrator name and password to install it and could then modify or overwrite any system file or application.

System Integrity Protection restricts the root account and limits the actions that the root user can perform on protected parts of OS X.

Paths and applications protected by System Integrity Protection include:

/System

/usr

/bin

/sbin

Apps that are pre-installed with OS X

Paths and applications that third-party apps and installers can write to include:

/Applications

/Library

/usr/local

System Integrity Protection is designed to allow modifications of these protected parts only by processes that are signed by Apple and have special entitlements to write to system files, like Apple software updates and Apple installers.

Apps that you download from the Mac App Store already work with System Integrity Protection. Other third-party software that conflicts with System Integrity Protection might be set aside when you upgrade to OS X El Capitan.

System Integrity Protection also helps prevent software from changing your startup volume. To boot your Mac from a different volume, you can use the Startup Disk pane in System Preferences or you can hold down the Option key while you reboot, and select a volume from the list.

Information about products not manufactured by Apple, or independent websites not controlled or tested by Apple, is provided without recommendation or endorsement. Apple assumes no responsibility with regard to the selection, performance, or use of third-party websites or products. Apple makes no representations regarding third-party website accuracy or reliability. Risks are inherent in the use of the Internet. Contact the vendor for additional information. Other company and product names may be trademarks of their respective owners.

https://support.apple.com/en-us/HT204899

解决方式

事实上解决方式就已经非常easy了,既然是系统中有 SIP 的问题,那么我们把它关闭就好了:

  1. 重新启动系统
  2. 按住 Command + R 进入 Recoverary 模式
  3. 点击 有用工具 > 终端
  4. 输入 csrutil disable
  5. 重新启动系统

这时我们再又一次编译安装 sip 就没有不论什么问题了。

最新文章

  1. jquery datepicker 只显示年月
  2. Something about "if"
  3. 【Hadoop】HIVE 小结概览
  4. hdu 5769 Substring 后缀数组 + KMP
  5. C++类的构造、拷贝构造、析构函数等
  6. [java学习笔记]java语言核心----面向对象基础
  7. input 标签左对齐
  8. 每天进步一点点——再次了解Linux进程ID
  9. AIX系统备份相关知识
  10. selenium+BeautifulSoup实现强大的爬虫功能
  11. “短路求值(Short-Circuit Evaluation)
  12. Gym 101911F “Tickets”
  13. [转帖] select、poll、epoll之间的区别总结[整理] + 知乎大神解答 https://blog.csdn.net/qq546770908/article/details/53082870 不过图都裂了.
  14. apache(httpd)配置
  15. apache atlas资料收集
  16. cnetos6上实现nfs共享
  17. fullcalendar 使用教程
  18. SharePoint 2013 处理Promoted Links类型的List下的Tiles View的默认Webpart展示方式
  19. echart知识点、常用图形
  20. 区间数字的按位与 Bitwise AND of Numbers Range

热门文章

  1. Binding Enum to ComboBox
  2. win7浏览器出现无法连接到代理服务器错误解决办法
  3. 0x53 区间DP
  4. nyoj--105--九的余数(水题)
  5. [源码管理] Microsoft Visual SourceSafe 2005 下载与配置
  6. 简单介绍export default,module.exports与import,require的区别联系
  7. HttpServletRequest二三事
  8. 从无到有创建一个grunt项目
  9. 企业级任务调度框架Quartz(9) Quartz之作业触发器Trigger
  10. 采用requests库构建简单的网络爬虫