Cocoapods安装流程 2021.6

一.安装RVM

(1)安装RVM:  curl -L get.rvm.io | bash -s stable

source ~/.bashrc , source ~/.bash_profile

(2)测试是否安装正常:  rvm -v

二.用RVM升级Ruby

(1)查看当前ruby版本:  ruby -v

(2)列出已知的ruby版本:  rvm list known

(3)安装ruby:  rvm install 3.0.0

注:安装ruby过程,因homebrew而导致失败,先卸载再安装homebrew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

(4)设置默认版本:  rvm 3.0.1 --default, 更新gem:  gem update --system

三.更换Ruby镜像

(1)检查当前镜像:  gem sources -l

(2)移除当前镜像:  gem sources --remove https://rubygems.org/ 

(3)更换新的镜像:  gem sources --add https://gems.ruby-china.com 

(4)检查新镜像是否安装成功:  gem sources -l

四.安装CocoaPods

(1) 安装:  sudo gem install -n /usr/local/bin cocoapods -v 1.10.1   

(2)下载Specs参考: https://mirrors.tuna.tsinghua.edu.cn/help/CocoaPods/

卸载:  sudo gem uninstall cocoapods

删除master分支:  sudo rm -fr ~/.cocoapods/repos/master

手动克隆完成后,文件夹目录如下:

(3)下载Specs完成后,检查是否能搜索: pod search AFNetworking

(4)创建Podfile: cd 工程主目录, pod init

(5)编写Podfile完成后,安装所需要的第三方库: pod install

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

推荐阅读更多精彩内容