Mac 新系统安装CocoaPods

Mac mini,新系统,安装CocoaPods
1、升级Ruby环境 gem update —system
2、出现 ERROR 没有写入权限 使用以下指令升级 sudo gem update —system
3、输入密码,光标不动。
4、输完密码按回车确定,开始更新。
5、没切换镜像,通过gem sources -l看到镜像是https://rubygems.org/
6、使用命令gem sources -a https://gems.ruby-china.org/切换镜像报错404,报错信息:Error fetching https://gems.ruby-china.org/:
bad response Not Found 404 (https://gems.ruby-china.org/specs.4.8.gz)
7、原来是域名换了,用https://gems.ruby-china.com/替换前面命令中的网址。
8、接着就是 sudo gem install cocoapods,又报错,You don’t have permissions for the usr/bin directory
9、将上述命令改为 sudo gem install -n /usr/local/bin cocoapods,等待完成。
10、完成后搜索第三方 pod search Masonry
11、接着显示 Setting up CocoaPods master repo
$ /usr/bin/git/ clone https://github.com/CocoaPods/Specs.git master —progress
Cloning into ‘master’…
然后就是等,拼网速,拼人品,不过下面都会有个进度显示。
12、等待结束后,搜索第三方。pod search Masonry 报错 [!] Unable to find a pod with name, author, summary, or description matching Masonry
13、执行pod setup,完毕后继续执行pod search命令,还是不行。
14、下面就是要删除索引缓存,执行rm ~/Library/Caches/CocoaPods/search_index.json命令。
15、再次执行pod search命令,会显示Creating search index for spec repo ‘master’… Done!字样,完成后会显示搜索结果。

猜你喜欢

转载自blog.csdn.net/Mr17Liu/article/details/82785307