MacOS 11.0.1 中cocoapods报ERROR: While executing gem ... (Gem::Ext::BuildError)

Ignoring ffi-1.12.1 because its extensions are not built. Try: gem pristine ffi --version 1.12.1

出现这个错误,首先可以尝试:

sudo gem pristine ffi

此时终端可能会报一下错误

Restoring gems to pristine condition...
Building native extensions. This could take a while...
ERROR:  While executing gem ... (Gem::Ext::BuildError)
    ERROR: Failed to build gem native extension.

这时,我们看到错误信息显示权限不够,我们可执行

sudo gem install cocoapods --pre

此时会输出如下:

Building native extensions. This could take a while...
Successfully installed ffi-1.13.1
Successfully installed public_suffix-4.0.6
Successfully installed addressable-2.7.0
Successfully installed cocoapods-core-1.10.0
Successfully installed cocoapods-downloader-1.4.0
Successfully installed nanaimo-0.3.0
Successfully installed xcodeproj-1.19.0
Successfully installed cocoapods-1.10.0
Parsing documentation for ffi-1.13.1
Installing ri documentation for ffi-1.13.1
Parsing documentation for public_suffix-4.0.6
Installing ri documentation for public_suffix-4.0.6
Parsing documentation for addressable-2.7.0
Installing ri documentation for addressable-2.7.0
Parsing documentation for cocoapods-core-1.10.0
Installing ri documentation for cocoapods-core-1.10.0
Parsing documentation for cocoapods-downloader-1.4.0
Installing ri documentation for cocoapods-downloader-1.4.0
Parsing documentation for nanaimo-0.3.0
Installing ri documentation for nanaimo-0.3.0
Parsing documentation for xcodeproj-1.19.0
Installing ri documentation for xcodeproj-1.19.0
Parsing documentation for cocoapods-1.10.0
Installing ri documentation for cocoapods-1.10.0
Done installing documentation for ffi, public_suffix, addressable, cocoapods-core, cocoapods-downloader, nanaimo, xcodeproj, cocoapods after 24 seconds
8 gems installed

明显可以看出安装成功,再尝试 pod --version

$ pod --version
1.10.0

好了,问题完美解决。

你可能感兴趣的:(iOS,ios,xcode)