cocoapods - 'pod install' takes forever
Asked Answered
C

20

327

I was trying to update the existing pods with the pod install command, but it takes forever to run.

The verbose mode shows it was stuck at the following line (forever)

Updating spec repo master

$ /usr/bin/git pull --no-rebase --no-commit

There is no network activity after it gets stuck.

Cchaddie answered 20/5, 2014 at 9:30 Comment(13)
after being stuck for 90 mins, pod install proceeds to next stage. I guess I am not very patient.Cchaddie
run pod install --verbose to see more debugging information. The general situation is git updating take too much time. If you don't need update, run pod install --no-repo-updateCommitteeman
Says something about the quality of pod. Those guys need to fix that soon. I am getting stuck on this everytime I have to deal with pod.Foliolate
Why are there 17,000+ directories in this specs folder? Is it keeping all the dependency info in the app itself?Chalice
90minutes? OMG. What is your internet speed, Hai Feng Kao?Has
@Rocotilos It's nothing to do with my internet speed. There is a post about it: CocoaPods is so popular it’s straining GitHub’s servers techsite.io/p/276312Cchaddie
@HaiFengKao, I was worried because my internet is not good.I tracked it, it was about 350MB being downloaded. Thx for the link, I think cocoapods need its own server.Has
Still equally slow 5 years on. 20k a second for a huge file. Ridiculous.Sanctum
Notice updated answer for 2019: https://mcmap.net/q/98536/-cocoapods-39-pod-install-39-takes-foreverCulmiferous
Duplicate of #21681073Mordacious
2022 and they don't fix itGq
Neither 2023.. weird.Ambulate
2024, 2030... because you assume that there is someone that actually cares about that. I'm pretty sure that cocoapods have been dead for at least 10 years.Zerline
E
567

I ran into the same problem, and I solved it by running the following commands which is given here

pod repo remove trunk
pod setup
pod install
Euphonic answered 9/7, 2015 at 6:33 Comment(8)
cocoapods - 'pod repo remove master' takes forever. Need to create new thread ? :)Cacique
Thanks , it work for me.and also you can add --verbose to show detail debug infoJacquelyn
@Cacique at first I thought pod repo remove master also takes forever. But turns out I just need several minutes more to wait. Your needed time may vary because I don't know your pods configuration, but just give it more time.Determinable
It would be nice to add an explanation to the given solution to make it clear.Blancablanch
The actual downloading takes time due to network bandwidth. We can check through Activity Monitor - Network tab - for process 'git-remote-http'. We need to have patience. You may refer this answer link - https://mcmap.net/q/100738/-cocoapods-setup-stuck-on-pod-setup-command-on-terminalSkricki
Even pod setup stuck at following, $ /usr/bin/git clone github.com/CocoaPods/Specs.git master Cloning into 'master'... You can skip pod setup instead "Go to ~/.cocoapods/repos and run 'git clone github.com/CocoaPods/Specs.git master'Marcasite
pod setup can also be stuck sometimes at 'cloning into master'. You can try cloning the repo yourself by going to '~/.cocoapods/repos' and running 'git clone github.com/CocoaPods/Specs.git master' as Ammar suggested.Ponderous
Still took forever and even with --verbose it's not exactly clear what the holdup is. Best just go for lunch while it runs.Village
A
215

you can run

pod install --verbose 

to see what's going on behind the scenes.. at least you'll know where it's stuck at (it could be a git clone operation that's taking too long because of your slow network etc)

to have an even better idea of why it seems to be stuck (running verbose can get you something like this

-> Installing Typhoon (2.2.1)
 > GitHub download
 > Creating cache git repo (~/Library/Caches/CocoaPods/GitHub/0363445acc1ed036ea1f162b4d8d143134f53b92)
 > Cloning to Pods folder
       $ /usr/bin/git clone https://github.com/typhoon-framework/Typhoon.git ~/Library/Caches/CocoaPods/GitHub/0363445acc1ed036ea1f162b4d8d143134f53b92 --mirror
       Cloning into bare repository '~/Library/Caches/CocoaPods/GitHub/0363445acc1ed036ea1f162b4d8d143134f53b92'...

is to find out the size of the git repo you're cloning.. if you're cloning from github.. you can use this format:

/repos/:user/:repo

so, for example, to find out about the above repo type

https://api.github.com/repos/typhoon-framework/Typhoon

and the returned JSON will have a size key, value. so the above returned

"size": 94014,

which is approx 90mb. no wonder it's taking forever! (btw.. by the time I wrote this.. it just finished.. ha!)


update: one common thing that cocoa pods do before it even starts downloading the dependencies listed in your podfile, is to download/update its own repo (they call it Setting up Cocoapods Master repo.. look at this:

pod install --verbose

Analyzing dependencies

Updating spec repositories
  $ /usr/bin/git rev-parse  >/dev/null 2>&1
  $ /usr/bin/git ls-remote
  From https://github.com/CocoaPods/Specs.git
  09b0e7431ab82063d467296904a85d72ed40cd73  HEAD
  ..

the bad news is that if you follow the above procedure to find out how big the cocoa pod repo is.. you'll get this: "size": 614373,.. which is a lot.

so to get a more accurate way of knowing how long it takes to just install your own repo.. you can set up the cocoa pods master repo separately by using pod setup:

$ pod help setup
Usage:

$ pod setup

  Creates a directory at `~/.cocoapods/repos` which will hold your spec-repos.
  This is where it will create a clone of the public `master` spec-repo from:

      https://github.com/CocoaPods/Specs

  If the clone already exists, it will ensure that it is up-to-date.

then running pod install

Avian answered 4/9, 2014 at 6:23 Comment(6)
This is the only coherent description of "WTF" cocoapods are "up to"... that I've ever seen.Groundless
the download of the master repo took me 20 minutes staring at just a blinking cursor (and i have only a 150Mb internet connection and just a lousy macbook pro retina i7)Chester
There are 17,000+ files/directories in the specs directory. It's not the most git friendly approach to whatever the heck it is they're doing there.Chalice
When I ran this command, my cocoapods showed me that it was finished. with its install. Thank you!Imminence
Most of the time it's about a big dependency that takes a lot of time to downloadMcginley
For me, it's downloading a 104MB file for Installing boost (1.76.0) and my internet is fine but it's still downloading at a slow speed.Aquaplane
C
56

Updated answer for 2019 - the cocoa pods team moved to using their own CDN which solves this issue, which was due to GitHub rate limiting, as described here: https://blog.cocoapods.org/CocoaPods-1.7.2/

TL;DR You need to change the source line in your Podfile to this:

source 'https://cdn.cocoapods.org/'
Culmiferous answered 27/10, 2019 at 7:8 Comment(3)
This made no difference for me.Kosak
from Cocoapods 1.8 it is default value - so for me it was helpful to remove source that lead to GitHub to fallback to default value (mentioned in this answer cdn.cocoapods.org). It decreased getting updates for more than 15 minutesPatmore
This little change saved me more than 10 minutes. Executing "pod install" now takes less than 2 minutes, while before making this changes it took about 12 minutes.Fluoro
A
31

Possible solutions:

  1. Updating Cocoa Pods may solve this issue
  2. Clean and fresh install pods again

Updating CocoaPods

Open terminal and type:

$ sudo gem update cocoapods

Reinstall Pods

Step 1

Remove all the pods from your project (tricky part):

Manually

  1. Remove all Pods records on Build Phases of your project (Marked Red)

enter image description here

  1. Remove libPods.a under Frameworks folder

enter image description here

  1. Now head to project directory and remove Podfile.lock*, **Pods folder and Workspace (Remove from Trash too).

Automatically using CocoaPods De-Integrate

Install

$ [sudo] gem install cocoapods-deintegrate

Run

$ pod deintegrate

Step 2

Here we are going through at installing the Pods again

Change your location your directory

$ cd yourprojectdirectory

Edit podfile by adding lines you need to it

$ open -a Xcode podfile 

or

$ nano podfile

FINALLY install the pod again

$ pod install

Hope this helps

Alderete answered 20/5, 2014 at 9:53 Comment(7)
useless. Just did a fresh install of cocoapods, pod init and pod install just hangs for everChester
@Chester Well it depends on what libraries you are fetching. You can try also this tool which de-integrates the pods from the project, and then run install againAlderete
none! thats the whole point. this happens when you start with init, then install on an empty project.Chester
@Chester What do you mean by none? Where is the point to install pods when there is no pods at all (if I understood you correctly)?Alderete
just starting an empty project and prepare it to add things later. so: create an xcode project, run pod init, run pod install. At this moment pod install hangs.Chester
Actually @Avian gave the right answer: it needs to download a repository with 94000 entries. this took 20 minutes. (with a 150Mb internet connection on a i7 macbook pro)Chester
my project fully error after run command "pod deintegrate"Nutty
S
23

I found another way to solve the problem

pod install --verbose --no-repo-update

it works for me.

Shahaptian answered 24/4, 2016 at 9:2 Comment(1)
Still have to clone the first time.Chalice
M
14

As pointed out here git-remote-http process running in background. I goto this process from Activity Monitor and quitting this process resumed the pod process which was stuck on "Updating local specs repositories" after POD INSTALL

Marcasite answered 18/9, 2015 at 4:47 Comment(0)
D
14

As of 15th August 2016, the repo is a massive 2.39GB file. I opened the Activity Monitor to look at what the terminal was doing. It was downloading this huge file.

Digiacomo answered 14/8, 2016 at 18:52 Comment(0)
L
11

This is what worked for me :

  1. Delete all the content under ~/.CocoaPods
  2. Delete your existing Podfile.lock and Pods folder.
  3. Leave your PodFile intact.
  4. Run sudo gem install cocoapods --verbose
  5. Run pod install --verbose

I recommend using the --verbose flag since Terminal is not great when giving progress on a command action. The verbose option helps a lot!

Lurcher answered 17/9, 2015 at 12:19 Comment(1)
Beware that the master repo at ~/.cocoapods is huge (~1GB), so deleting and reinstalling it takes a long time. If I had realized this, I would have tried pod install --verbose before resorting to deleting the master repo.Turnpike
J
9

Just go through the below step-by-step:

Download https://github.com/CocoaPods/Specs/archive/master.zip

RUN the Below commands in terminal:

pod setup --verbose

Open new tab in the terminal and RUN

mv ~/.cocoapods/repos/master/.git ~/tempSpecsGitFolder

open master.zip (unzipping it)

mv Specs-master ~/.cocoapods/repos/master

mv ~/tempSpecsGitFolder ~/.cocoapods/repos/master/.git

cd [project folder]

pod install --no-repo-update

Joyance answered 30/7, 2016 at 14:44 Comment(0)
S
6

Try clearing your CocoaPods cache, re-download and re-install all pods as described here

rm -rf "${HOME}/Library/Caches/CocoaPods"

rm -rf "\`pwd\`/Pods/"

pod update
Sanferd answered 4/3, 2015 at 22:15 Comment(0)
C
4

As mentioned in other answers, It takes forever because the size of cocoapods master repo is huge. This time can be reduced using the following steps.

1) Create a private specs file path on your github repository. Provide this path https://github.com/yourpathForspecs.git' as a source in your podfile.

2) identify ALL the repositories You need and their dependencies( mentioned in the podspec.json file on cocoapods for these repositories) and get their podspec.json files from cocoapods. add these podspec.json files with their folder ( say the latest version folder for bolts) in this specs repository.

3) remove the source 'https://github.com/CocoaPods/Specs.git' in the podfile

4) pod update

This will take significantly less time as this requires fetching and downloading just the pods you need instead of whole cocoapods repository. In My case it reduced the pod update time from 15-20 mins on average to 3-4 mins at most.

Castellanos answered 3/11, 2016 at 20:16 Comment(0)
H
2

Even I was thinking the same. If you open Activity Monitor you can see that it is downloading something at there on the name of GIT.

I found this tip useful.

https://mcmap.net/q/100738/-cocoapods-setup-stuck-on-pod-setup-command-on-terminal

Hersh answered 10/12, 2016 at 11:54 Comment(0)
D
1

I had the same problem, I then realized that I was still running Network Conditioner on "Very Bad Network". Turning that off solved the issue.

Hope that helps someone.

Divergence answered 3/2, 2016 at 14:23 Comment(0)
G
1

I fixed this issue like that:

rm -fr ~/Library/Caches/CocoaPods && \
gem update --system && \
gem update && \
gem cleanup && \
pod setup

Reference: http://blog.cocoapods.org/Repairing-Our-Broken-Specs-Repository/

Guimpe answered 9/3, 2016 at 7:34 Comment(1)
My pod setup was taking forever and I aborted after 30minutes. I just followed this procedure and the git clone now finished after about 5 minutes.Unwelcome
F
1

I had the same issue. After running

pod install
Setting up CocoaPods master repo

The iterm2 was stuck on Setting up CocoaPods.

I solved the issue by running

sudo gem install CocoaPods

This is mentioned in the CocoaPods website

Foote answered 26/1, 2018 at 13:47 Comment(0)
S
1

After a half of the day of investigating why Analyzing Dependencies takes forever, I found out that I was installing the latest Firebase pod (7.1.0), which relies on GoogleAppMeasurement version 7.1.0, and there was another pod, which is an ad mediation framework, which includes Google-Mobile-Ads-SDK. This SDK was relying on a much lower version of GoogleAppMeasurement ~ 6.0. I was able to install the pods by commenting out the conflicting pod from the ad mediation. Something like this:

# Ad network framework
  pod 'SomeMediationNetwork/Core'
#  pod 'SomeMediationNetwork/GoogleMobileAds' # - the conflicting pod
  pod 'SomeMediationNetwork/Facebook'
  pod 'SomeMediationNetwork/SmartAdServer'
  pod 'SomeMediationNetwork/Mopub'

I had to contact the ad mediation library publisher to fix this issue, most probably by updating to the latest Google-Mobile-Ads-SDK pod and releasing a new version.

I hope this one helps some other folks who are banging their head

Sard answered 11/11, 2020 at 13:41 Comment(0)
S
1

I tried everything on this page, nothing worked. Downloading 100MB took me about 30 minutes.

Then I connected via VPN to a server in the US and ran pod install --verbose again, download speed went up and installing 100MB took 20 seconds.

Looks like download speed is limited for some locations (in this case South America).

Scabrous answered 29/10, 2023 at 23:53 Comment(0)
C
0

Sometimes happen to me too and I simply:

pod clean
pod update --verbose
Cosby answered 31/3, 2016 at 14:3 Comment(1)
There are no commands like pod clean ?Reactance
L
0

Solution for me in 11.2019

Hello i tried a lot of things, but nothing worked. Try just to connect to this site https://cdn.cocoapods.org/ if you can't so just use VPN and do pod install etc. And don't forget to use --verbose for understanding what's happening.

Lugger answered 25/11, 2019 at 18:55 Comment(0)
K
0

Found an alternative way to download cocoapods is to download one of the snapshots available here. It is a bit old but the .bz2 compressed file was much faster to download. Once I had downloaded it, I copied it over to ~/.cocoapods/repos/ and then I unzipped it using bzip2 -dk *.bz2.

The unzipping took a while and once it was over, I changed the extension of the newly uncompressed file to .tar and did tar xvf *.tar to unzip that. This will show the list of files being created and will also take a while.

Finally when I ran pod repo list while inside the project folder, it showed the master folder had been added as a repo. Because I still kept getting an error that it was unable to find the specification for the pod I was looking for, I went to the master folder and did git fetch and then git merge. The git fetch took the longest, about an hour at 50 KB/s. I used fetch and merge instead of pull, as I was having issues with it, i.e. fatal: the remote end hung up unexpectedly. It is now up to date and I was able to get the pod I wanted.

Kosak answered 4/9, 2020 at 9:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.