MacOS安装cocoapods
-
安装brew
1 |
|
-
安装ruby
brew install ruby
-
更换Ruby镜像
先移除现在的镜像 终端输入:
gem sources --remove https://rubygems.org/
然后替换成现在大中华地区可用的(taobao的那个镜像已经不好用了)
gem sources -a https://gems.ruby-china.com/
执行完之后查看是否替换成功
gem sources -l
输出结果1
2*** CURRENT SOURCES *** https://gems.ruby-china.org/
说明替换成功
-
安装cocoapods
终端输入:
sudo gem install -n /usr/local/bin cocoapods
或者sudo gem install cocoapods -n /usr/local/bin
之后在执行
pod setup
输出1
2
3
4
5
6Setting up CocoaPods master repo $ /usr/bin/git clone https://github.com/CocoaPods/Specs.git master --progress Cloning into 'master'... remote: Counting objects: 2038413, done. remote: Compressing objects: 100% (6489/6489), done. Receiving objects: 11% (239182/2038413), 47.75 MiB | 2.00 KiB/s
这是一个漫长的等待。。。
-
如何卸载cocoapods
终端输入:
sudo gem uninstall cocoapods
-
拉取cocoapods仓库
Cloning spec repo
cocoapods
卡住cocoaPod安装完之后, 第一次进行
pod install
操作。可能会出现卡住不动或者的情况,只是由于cocoapPod安装好了, 但是必要的资源还没准备好,后台在默默的下载,具体大小,可根据git的api中的size查看1
2
3Cloning spec repo `cocoapods` from `https://github.com/CocoaPods/Specs.git` [!] Unable to add a source with url `https://github.com/CocoaPods/Specs.git` named `cocoapods`. You can try adding it manually in `/Users/98-elden/.cocoapods/repos` or via `pod repo add`.
解决办法: 1、去git仓库下载好资源,倒入本地文件夹下
.cocoapods/repos/cocoapods/
解决方法来源![img](https:////upload-images.jianshu.io/upload_images/5955701-877577cc0ba714d5.png?imageMogr2/auto-orient/strip imageView2/2/w/733) 问题
homebrew安装好之后homebrew-core文件夹里面是空的
sudo git clone git://mirrors.ustc.edu.cn/homebrew-core.git/ /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core