If you are an iOS developer then nobody can understand this issue better than you could. Trying to update the existing pod and seeing it stuck is one of the common problems that occur in cocoapods. Did it happen with you too? Let us find out the ways to handle this problem.
Sometimes, using pod install command in cocoapods can put you in trouble. It will take forever to run. With the help of verbose mode, you can know where it is stuck as shown in the following code.
"Updating spec repo master
$ /usr/bin/git pull --no-rebase --no-commit
Before moving on to the solution, it is important to give you a hint about cocoapods if you don’t know.
What is cocoapods?
Cocoapods acts as a manager of library dependencies for your Xcode projects. It’s home to more than 69 thousand libraries. It is also a dependency manager for the Objective C or any other language running on the Objective-C runtime. It basically aims at the source-based distribution of third party code and integration into Xcode projects automatically. It runs from the command line. Moreover, its function is to installing dependencies for an application by specifying them instead of copying. These dependencies are specified in a file known as Podfile.
Solution to your Problem
There are a number of solutions to this problem. Get to know them and try one by one till your problem doesn’t get solved.
- By using a simple command, the problem can be solved easily. Follow the command as given
pod repo remove master
pod install --verbose --no-repo-update
- To find out what is going on and what is leading the pod install to remain stuck, try running
pod install --verbose
- To get deeper info on why it is stuck at something shown below, you need to get the size of the git repo that you are cloning.
-> 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'
Use the command
- Try to update cocoapods to solve the issue. Firstly, open the terminal and type:
$ sudo gem update cocoapods
- . If the problem hasn’t gone away, you can try deleting and installing pods again. It’s a little bit challenging to remove pods files from your project. Try to do it manually by following the given steps:
- From the Build Phased, remove the pods record marked in red.
- In the Framework folder, remove libPods.a
- Move to the project directory and delete Podfile.lock*, **Pods folder and Workspace. You must delete them from the trash folder too.
- Install and use CocoaPods De-integrate and run it.
$ [sudo] gem install cocoapods-deintegrate
$ pod deintegrate
- Change the location of your directory
$ cd yourprojectdirectory
- Edit the profile as needed and add the required lines
$ open -a Xcode podfile
- Or, you can write this command:
$ nano podfile
- At last, run this command to reinstall the pod.
$ pod install
Cocoapods help you in building amazing projects. All the solutions mentioned in this article is working to solve your problem of "pods install take forever".