Cocoapods升级报错Error installing cocoapods: Failed to build gem native extension

很长一段时间未用cocoapods,更新不了最新的三方库,要求升级cocoapods。

1、升级Ruby环境

 

sudo gem update --system

2、更新cocoapods

 

sudo gem install -n /usr/local/bin cocoapods

结果报错:

 

Building native extensions. This could take a while...
ERROR:  Error installing cocoapods:
    ERROR: Failed to build gem native extension.

    current directory: /Library/Ruby/Gems/2.3.0/gems/ffi-1.12.2/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20200309-13044-14m1r7i.rb extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in /Library/Ruby/Gems/2.3.0/gems/ffi-1.12.2 for inspection.
Results logged to /Library/Ruby/Gems/2.3.0/extensions/universal-darwin-18/2.3.0/ffi-1.12.2/gem_make.out

各种查资料,折腾一天 ,终于解决:

 

open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg

安装成功后继续运行:

 

sudo gem install -n /usr/local/bin cocoapods
Building native extensions. This could take a while...
Successfully installed ffi-1.14.2
Successfully installed ethon-0.12.0
Successfully installed typhoeus-1.4.0
Successfully installed public_suffix-4.0.6
Successfully installed concurrent-ruby-1.1.8
Successfully installed addressable-2.7.0
Successfully installed activesupport-5.2.4.5
Successfully installed cocoapods-core-1.10.1
Successfully installed cocoapods-1.10.1
Parsing documentation for ffi-1.14.2
Installing ri documentation for ffi-1.14.2
Parsing documentation for ethon-0.12.0
Installing ri documentation for ethon-0.12.0
Parsing documentation for typhoeus-1.4.0
Installing ri documentation for typhoeus-1.4.0
Parsing documentation for public_suffix-4.0.6
Installing ri documentation for public_suffix-4.0.6
Parsing documentation for concurrent-ruby-1.1.8
Installing ri documentation for concurrent-ruby-1.1.8
Parsing documentation for addressable-2.7.0
Installing ri documentation for addressable-2.7.0
Parsing documentation for activesupport-5.2.4.5
Installing ri documentation for activesupport-5.2.4.5
Parsing documentation for cocoapods-core-1.10.1
Installing ri documentation for cocoapods-core-1.10.1
Parsing documentation for cocoapods-1.10.1
Installing ri documentation for cocoapods-1.10.1
Done installing documentation for ffi, ethon, typhoeus, public_suffix, concurrent-ruby, addressable, activesupport, cocoapods-core, cocoapods after 35 seconds
9 gems installed

 

搞定!

 

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值