cmake 安装第三方库时遇到 Operation not permitted 相关问题

下载安装“complex_bessel”库时候遇到的问题。
以下是安装步骤。

The library uses CMake for compilation. The user should thus install CMake
on their machine. On Ubuntu and other Debian-based OSes, this can be done
by running

sudo apt-get install cmake

On Arch Linux

sudo pacman -S cmake

The user should then run

bash build.sh

which will create a build/ directory and run make automatically. When
you are ready to install the files, just run

cd build
sudo make install

The library will be installed to /usr by default.

在最后一步遇到问题如下。

ushiushi@MacBook-Pro build % sudo make install
Password:
[100%] Built target complex_bessel
Install the project.
-- Install configuration: ""
-- Installing: /usr/lib/libcomplex_bessel.0.6.0.dylib
CMake Error at cmake_install.cmake:41 (file):
file INSTALL cannot copy file
"/Users/ushiushi/Study/complex_bessel-release-0.6/build/libcomplex_bessel.0.6.0.dylib"
to "/usr/lib/libcomplex_bessel.0.6.0.dylib": Operation not permitted.

想请问一下问题发生的原因和解决思路。

最后一步是安装到系统目录/usr/lib中,这个是需要管理员权限的,但是你用了sudo苹果却拒绝安装,应该是有些保护目录的措施,
你可以试一试确认是否是因为sip的原因,链接为

看看磁盘空间

现在gcc用的什么版本,更换一下版本试一下。
使用gcc 5.4,有问题的CMake片段工作正常