macbook安装cocoapods

Macbook自带ruby的环境所以不用安装ruby,所以直接确定一下ruby的源就可以了


1.查看ruby源

cmd:gem source -l
结果:
*** CURRENT SOURCES ***
https://rubygems.org/


2. 替换ruby源 2.1 移除源
cmd:gem source --remove https://rubygems.org/
结果:
https://rubygems.org/ removed from sources
2.2 修改源
cmd:gem source -a https://ruby.taobao.org/
结果:
Error fetching https://ruby.taobao.org/:
bad response Not Found 404 (https://gems.ruby-china.org/specs.4.8.gz)
意思是说:baotao这个已经不再维护了,已经重定向到 https://gems.ruby-china.org/这里了,所以修改源的时候要用这个链接
2.2.1 添加源
cmd:gem source -a https://gems.ruby-china.org/
结果:
Error fetching http://gems.ruby-china.org/:
bad response Not Found 404 (https://gems.ruby-china.org/specs.4.8.gz)
我勒个去,还是这个错误什么鬼?其实还是链接的问题...org问题不能用了,用.com域名代替了,具体查看【Ruby China服务域名更换公告】,所以...聪明如你应该知道怎么做了~
2.2.2 又要添加源了
cmd:gem sources -a https://gems.ruby-china.com
结果:
*** CURRENT SOURCES ***
https://gems.ruby-china.com
~哇哦...
2.2.2 更新Gem
cmd:sudo gem update --system
查看版本:gem -v
3. 安装cocoapods
cmd:sudo gem install -n /usr/local/bin cocoapods


3.1 初始化cocoapods
cmd:pod setup
问题:这里可能会很慢、报错、卡住等问题,【移步这里查看解决办法】,【或者这里】,我用上面的方法后依然不是很快,几十kb~几百kb的样子波动,不过已经看到在下载了,也算安慰吧...我擦

macbook安装cocoapods
文章图片
正在下载哦.avi
下载后,用 pod repo 命令后输出
Specs
sh: line 1: 9534 Segmentation fault: 11 git name-rev --name-only HEAD 2> /dev/null
- Type: git (unknown)
- URL: https://github.com/CocoaPods/Specs.git
- Path: /Users/iroot/.cocoapods/repos/Specs
1 repo
并非master,这时需要进入~/.cocoapods/repos目录
通过命令【 mv Specs master 】 将Specs更改为master
再次输入命令 pod repo 后输出结果:
master
sh: line 1: 9550 Segmentation fault: 11 git name-rev --name-only HEAD 2> /dev/null
- Type: git (unknown)
- URL: https://github.com/CocoaPods/Specs.git
- Path: /Users/iroot/.cocoapods/repos/master
1 repo
(更新本地库:pod repo update)


4.没了,就到这里了 5. 关于version 1.8+ CDN报错 【macbook安装cocoapods】于2020-05-18编辑
CDN: trunk URL couldn't be downloaded

    推荐阅读