Cocoapods卸载与安装 - 支持M1

环境:macbookpro - M1 Pro版
按照传统的安装cocoapods后执行pod install报错:

  ...
  648 /Library/Ruby/Gems/2.6.0/gems/ethon-0.15.0/lib/ethon/curls/functions.rb
  649 /Library/Ruby/Gems/2.6.0/gems/ethon-0.15.0/lib/ethon/curls/constants.rb
  650 /Library/Ruby/Gems/2.6.0/gems/ethon-0.15.0/lib/ethon/curls/settings.rb

[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: https://www.ruby-lang.org/bugreport.html

查了原因是新版M1的macbookpro架构问题,需要卸载cocoapods,然后通过brew install cocoapods来安装cocoapods。

1. 卸载cocoapods

which pod找到pod执行文件/usr/local/bin/pod

sudo rm -rf /usr/local/bin/pod

接下来找cocopod的安装包的地址,执行:

gem list

*** LOCAL GEMS ***
...
cocoapods (1.11.2)
cocoapods-core (1.11.2)
cocoapods-deintegrate (1.0.5)
cocoapods-downloader (1.5.1)
cocoapods-plugins (1.0.0)
cocoapods-search (1.0.1)
cocoapods-trunk (1.6.0)
cocoapods-try (1.2.0)
...

找到后,逐一卸载

sudo gem uninstall cocoapods
···
sudo gem uninstall cocoapods-try 

清理完毕。

2. 安装cocoapods

执行

brew install cocoapods
结果
3. 执行pod install成功
pod install

参考文章

CocoaPods安装与卸载 https://blog.csdn.net/xibeier_jw/article/details/114066372
iOS 错误汇总 长期更新 http://events.jianshu.io/p/a1972c368e5a

你可能感兴趣的:(Cocoapods卸载与安装 - 支持M1)