Solve Cocoapods thief slow problem

As a iOS developer, from time to time with some good use of framework or library dealing, and most foreign or address, access is slow, so it has caused a series of thief slow problem, the article is to sum up the solution

First, replace the gem source

/ / view existing source gem source -l

I’ve changed the source of Taobao before, and here it will show []


But now Taobao source was no longer maintained, so need to change at home and still maintain the [ruby-china], if not changed the default is [], this is foreign, for us is relatively slow, so it must be more change

Remove the gem sources --remove / / / / gem sources --remove add ruby-china source

Two, replace the pod repo source

I believe that the most of the friends of the friends of the repo source or [], because when we start the installation of the pod [pod setup] and the implementation of this is the default for our foreign source is installed. In fact, this setup just clones CocoaPods/Specs through git locally, so that’s what we can do

We need to pay attention to this point, that is, the storage location is fixed


If you don’t have this directory, create it yourself. You don’t have to create it any more

MKDIR -p ~/.cocoapods/repos/

Perform [pod repo] to view the current warehouse information

Pod repo

If there are multiple folders, there will be multiple letter related messages

- Type: git (unknown) - URL: - Path: /Users/lxf/.cocoapods/repos/master

OK, let’s start replacing the pod repo source. Here I choose the Specs on my home [], and there are other domestic ones that need to be searched by myself. Here’s the example of coding on Specs

The current foreign / / Master / / remove repo pod created to remove the Coding through the GIT clone and modify the folder to the local name for master git clone ~/.cocoapods/repos/master

As shown in the figure, downloading the pod repo source [here please ignore my speed, bandwidth suck, or it will fix the hissing]

Solve Cocoapods thief slow problem

Finally, I need update

Pod repo update
Solve Cocoapods thief slow problem
repo update

Note: the first line of the podfile file created in each project is to fill out the following line source command. This may be faced with the use of the third party library, not the latest problems, such as gitHub above a third party library is already 3, and the results can only download the use of 2.x, this measure of their own bar. Of course, you can also build a new project on your own Coding, sync CocoaPods/Specs to your own warehouse, but then use ~!

Solve Cocoapods thief slow problem
/ / can use my warehouse in Specs, update time: 2017-6-25

Three, replace the Homebrew source

This is not necessary, just make an additional supplement ~ ~
hand upgrade a little Cocoapods, and then prompted git version of the problem, please look down the specific circumstances ~!

Upgrade Git

After upgrading the Cocoapods, whatever the pod command is executed, the GIT version problem is prompted

For example, the command pod repo / pod setup pod install | |
/ / git version of the problem, using the current CocoaPods to git version of above 1.8.5 [You] need at least! Git version 1.8.5 to use CocoaPods

View the current git version

Git --version

Well, the current version of Git is pretty old, too

Git version

Here we use Homebrew to help us upgrade git. But, first of all, there is no rush to upgrade. We will change the source of Homebrew into the domestic image source of Tsinghua

CD "$(brew --repo)" git remote set-url origin brew update / / update the local image

The update will prompt Already up-to-date., and then update the GIT

Brew install Git

Solve the wrong problem

Error: Another active Homebrew update process is already in progress. Please wait for it to finish or terminate it to continue. Warning: git 2.13.1 is already installed, it's just not linked. You can use `brew link git` to link this version.

Here, according to its requirements, step by step operation

Solve Cocoapods thief slow problem