[ios] cocoapods - 'pod install' takes forever

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.

This question is related to ios command cocoapods repo pod-install

The answer is


I found another way to solve the problem

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

it works for me.


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/'

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.


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!


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://stackoverflow.com/a/21916507/563735


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


Sometimes happen to me too and I simply:

pod clean
pod update --verbose

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


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/


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


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.


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.


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.


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


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

pod repo remove master
pod setup
pod install

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


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

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


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.


Examples related to ios

Adding a UISegmentedControl to UITableView Crop image to specified size and picture location Undefined Symbols error when integrating Apptentive iOS SDK via Cocoapods Keep placeholder text in UITextField on input in IOS Accessing AppDelegate from framework? Autoresize View When SubViews are Added Warp \ bend effect on a UIView? Speech input for visually impaired users without the need to tap the screen make UITableViewCell selectable only while editing Xcode 12, building for iOS Simulator, but linking in object file built for iOS, for architecture arm64

Examples related to command

'ls' is not recognized as an internal or external command, operable program or batch file Command to run a .bat file how to run python files in windows command prompt? Run a command shell in jenkins How to recover the deleted files using "rm -R" command in linux server? Split text file into smaller multiple text file using command line ansible : how to pass multiple commands Jmeter - Run .jmx file through command line and get the summary report in a excel cocoapods - 'pod install' takes forever Daemon not running. Starting it now on port 5037

Examples related to cocoapods

Undefined Symbols error when integrating Apptentive iOS SDK via Cocoapods The iOS Simulator deployment targets is set to 7.0, but the range of supported deployment target version for this platform is 8.0 to 12.1 Xcode 10.2.1 Command PhaseScriptExecution failed with a nonzero exit code Updating to latest version of CocoaPods? 'Linker command failed with exit code 1' when using Google Analytics via CocoaPods ld: framework not found Pods How to update a single pod without touching other dependencies Error "library not found for" after putting application in AdMob cocoapods - 'pod install' takes forever Xcode - ld: library not found for -lPods

Examples related to repo

cocoapods - 'pod install' takes forever

Examples related to pod-install

How to update a single pod without touching other dependencies cocoapods - 'pod install' takes forever Pod install is staying on "Setting up CocoaPods Master repo" pod install -bash: pod: command not found