卸载并重装cocoapods

一、重装cocoapods

1.卸载原有cocoapods

rm -fr ~/.cocoapods/

2.查询Ruby源地址为:https://gems.ruby-china.com/

gem sources -a https://gems.ruby-china.com/
gem source -l

3.安装homebrew (时间略久,等就完事儿)

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

4.安装rvm

curl -L get.rvm.io | bash -s stable
source ~/.bashrc
source ~/.bash_profile

5.安装ruby

rvm install 3.2.2

6.设置成默认版本

rvm use 3.2.2 --default

7.安装cocoapods

sudo gem install -n /usr/local/bin cocoapods
image.png
pod setup

finish
遇到 command not found: pod
直接卸载重装

二、repo源

目前有两种常用的repo,一个master,一个trunk,分情况使用,如果trunk不能拉取可在podfile中添加
source "https://github.com/CocoaPods/Specs.git"
使用master源拉取代码,然后再行 pod install

image.png

问题:如果在pod update时报错 CocoaPods was not able to update the cocoapods repo. If this is an unexpected issue and persists you can inspect it running pod repo update --verbose

image.png

解决:
1.查看repo

pod repo

2.只保留master和trunk,把不用的repo删除

pod repo remove cocoapods 
image.png

3.再次拉取 恭喜成功

pod install

此为将trunk源更换为master拉取


image.png
最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容