[CocoaPods] - Ignoring ffi-1.12.2 because its extensions are not built. Try: gem pristine ffi --v...

执行pod命令时出现如上提示 如pod --version pod install gem source -l等命令时 出现如下提示
Ignoring ffi-1.12.2 because its extensions are not built. Try: gem pristine ffi --version 1.12.2
解决方案:执行命令:sudo gem install cocoapods-core
划重点:sudo是linux系统管理指令,是允许系统管理员让普通用户执行一些或者全部的root命令的一个工具

查看了下 pod版本为1.9.1 Homebrew版本为 2.5.6 gem版本为3.0.3
整个操作过程如下:
一、根据提示执行命令:gem pristine ffi --version 1.12.2
依旧报错
Ignoring ffi-1.12.2 because its extensions are not built. Try: gem pristine ffi --version 1.12.2 ERROR: While executing gem ... (Gem::FilePermissionError) You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory.

二、提示没有write权限,根据提示打开/Library/Ruby/Gems/2.6.0,果然是只读权限
修改权限 再次执行命令:gem pristine ffi --version 1.12.2
依旧报错 提示权限被拒绝
Ignoring ffi-1.12.2 because its extensions are not built. Try: gem pristine ffi --version 1.12.2 Restoring gems to pristine condition... ERROR: While executing gem ... (Errno::EACCES) Permission denied @ rb_sysopen - /Library/Ruby/Gems/2.6.0/gems/ffi-1.12.2/.appveyor.yml

三、一脸懵逼的开始查找资料
参考链接:https://blog.csdn.net/shenyiyangnb/article/details/80897724
执行命令:sudo gem install cocoapods-core
执行成功之后再次执行pod --version pod install gem source -l等命令时就正常了

四、然后继续一脸懵逼 执行命令gem pristine ffi --version 1.12.2 依旧权限不够
解决方案:执行命令时加上sudo sudo是linux系统管理指令,是允许系统管理员让普通用户执行一些或者全部的root命令的一个工具
sudo gem pristine ffi --version 1.12.2

输入密码 执行成功

Password:
Restoring gems to pristine condition...
Building native extensions. This could take a while...
Restored ffi-1.12.2

然后会出现
Insecure world writable dir的异常警告!
warning: Insecure world writable dir /usr/local in PATH, mode 040777

要去除这个警告,需要更改/usr/local的权限即可,命令如下:
sudo chmod go-w /usr/local

整理自:https://www.jianshu.com/p/8199ce31d5e5,https://www.jianshu.com/p/d3c9919f453c

你可能感兴趣的:([CocoaPods] - Ignoring ffi-1.12.2 because its extensions are not built. Try: gem pristine ffi --v...)