更改gem源
这里的 https://rubygems.org/
可以不进行变动,前提是你代理方能够访问的话,就可以跳过变更 gem
源
gem sources -l
gem sources --remove https://rubygems.org/
gem sources --add https://gems.ruby-china.com
gensees-iMac:~ gensee$ gem sources -l
*** CURRENT SOURCES ***
https://rubygems.org/
https://gems.ruby-china.com
gensees-iMac:~ gensee$ gem sources --remove https://rubygems.org/
https://rubygems.org/ removed from sources
gensees-iMac:~ gensee$ gem sources --add https://gems.ruby-china.com
source https://gems.ruby-china.com already present in the cache
gensees-iMac:~ gensee$
由于gem源有可能变动,这里去 https://gems.ruby-china.com
查看最新即可
设置代理端口
设置代理
这里的设置是全局的
//端口号可以自己更改
git config --global http.proxy 'socks5://127.0.0.1:7890'
git config --global https.proxy 'socks5://127.0.0.1:7890'
//一般来说设置前两个就行了
git config --global http.proxy http://127.0.0.1:7890
git config --global https.proxy http://127.0.0.1:7890
这里的127.0.0.1代表本机地址,然后端口是7890,如果使用SS的同学,需要查看配置,端口号可以自己更改

这里必须一致才行
查看代理
git config --global --get http.proxy
git config --global --get https.proxy
取消方法
#取消
git config --global --unset http.proxy
git config --global --unset https.proxy
验证
这里使用git clone指令验证
gensees-iMac:git gensee$ git clone https://github.com/AFNetworking/AFNetworking.git
Cloning into 'AFNetworking'...
remote: Enumerating objects: 9, done.
remote: Counting objects: 100% (9/9), done.
remote: Compressing objects: 100% (2/2), done.
Receiving objects: 21% (3339/15468), 796.01 KiB | 514.00 KiB/s
这里就可以看到下载速度了,如果你的速度还是10几K,那就看看是不是没有设置成功呢,例如没有开启BBR,没开BBR是很慢的。
然后,你就可以用 pod install
什么的指令了,起飞吧
Link: