Nike Kov
Nike Kov

Reputation: 13761

Сocoapods trunk URL couldn't be downloaded

I am getting this error when I try to pod repo update and pod install

CDN: trunk URL couldn't be downloaded: https://cdn.cocoapods.org/deprecated_podspecs.txt, error: Failed to open TCP connection to cdn.cocoapods.org:443 (No route to host - connect(2) for "cdn.cocoapods.org" port 443)

Does somebody know how to fix this problem?

Upvotes: 174

Views: 125027

Answers (27)

Nike Kov
Nike Kov

Reputation: 13761

It seems that it's a cdn problem because when i use proxy the link https://cdn.cocoapods.org/all_pods_versions_e_2_1.txt is opened and when not it return error.

What i did: gem uninstall cocoapods gem cleanup rvm osx-ssl-certs update all

That didn't help.

Then i went to Chrome and opened https://cdn.cocoapods.org/all_pods_versions_e_2_1.txt it was an error. Then i cleared cache but it didn't help. After switching to proxy and returning back it started to work.

Resume: Turn on and switch off the VPN.


Also try to pod cache clean --all and pod setup by @NightWatcher


Ensure that cocoapods don't have errors: https://status.cocoapods.org/#month


  1. Remove Podfile.lock and Pods/
  2. pod install

Upvotes: 36

TheReal2bz
TheReal2bz

Reputation: 11

If you're reading this in 2024, this is how I solved this issue:

make clean
pod deintegrate
pod install --repo-update 

Upvotes: 0

ovo
ovo

Reputation: 2172

Just ran pod install --repo-update, and everything worked for me.

Upvotes: 0

Maxim
Maxim

Reputation: 486

If you use Charles Proxy - quit it and restart IDE

Upvotes: 0

ims
ims

Reputation: 175

This worked for me, on Apple Mac with M1:

gem uninstall cocoapods
arch -x86_64 brew install cocoapods
arch -x86_64 brew reinstall cocoapods
brew link --overwrite cocoapods

Upvotes: 1

Medhi
Medhi

Reputation: 3245

If you stuck with this annoying error, here all the solutions in order.

1: Try update cocoapods

sudo gem install cocoapods

Then pod update / install.

2: Remove cocoapods cache

pod cache clean --all
pod setup

Then pod update / install.

3: Remove cocoapods cache

pod repo remove trunk
pod repo remove master

Add source in your podfile:

source 'https://github.com/CocoaPods/Specs.git'
source 'https://cdn.cocoapods.org/'

Then pod update / install.

4: Uninstall / reinstall Cocoapods

gem uninstall cocoapods
brew install cocoapods

Then pod update / install.

5: Try reboot Mac

The last chance... Then pod update / install.

Upvotes: 2

Mohamed Gadallah
Mohamed Gadallah

Reputation: 203

Managed to solve this problem by using Cloduflare's WARP which is a proxy server

Downloaded from here:

https://1.1.1.1/

Upvotes: 0

Moataz Fouuad
Moataz Fouuad

Reputation: 113

I was experiencing this issue, when I used VPN every thing was fine!

Upvotes: 2

Hosam Abdelnaser
Hosam Abdelnaser

Reputation: 147

If all the answers did not help, try these steps:

  1. Make sure you're in ios folder and list all available pod repos

    pod repo list

  2. Iterate over the list and delete all of them

    pod repo remove [repo_name]

  3. In any folder on your local machine, clone Cocoapods Github repo

    git clone "https://github.com/CocoaPods/Specs.git"

  4. At the top of your podfile, reference only this local repo

    source '/Users/hossamabdelnaser/Specs' # This depends on where you cloned the repo

  5. Make sure you're in ios folder and install pods

    pod install

Hope that helps

Upvotes: 0

Mohamed Hassan
Mohamed Hassan

Reputation: 1039

just remove Pods folder and Podfile.lock

add

source 'https://github.com/CocoaPods/Specs.git'

to the top Podfile

then clean cache pod cache clean --all

finally update and install pod pod install --repo-update

Upvotes: 2

Gene M
Gene M

Reputation: 418

Someone might be checking on this in 2023 so here's what I did (in a React Native project)

$ cd ios/
$ pod repo remove trunk
$ pod deintegrate
$ pod cache clean --all
$ pod install

Upvotes: 6

Ismoil Xolmatov
Ismoil Xolmatov

Reputation: 1

it's up to proxy servise you've to do is all first open up your proxy and set it up into your country or turn it off temporarely and clean your xcode build folder and try again pod install ro pod update I hope that'll work

Upvotes: 0

amishra
amishra

Reputation: 951

Faced the same issue and tried all the answers suggested above. But, the real issue seemed to be with not being able to access the Git repo for Cocoapods: ‘error: cannot open .git/FETCH_HEAD: Permission denied

Executing sudo chown -R $USER: . at /Users/user_name/.cocoapods/repos/cocoapods fixed the issue

Upvotes: 0

Nitish
Nitish

Reputation: 1063

I had the same issue. I followed below steps and it works.

I suggest to restart the system before following below instructions.

Delete Podfile.lock add source 'https://github.com/CocoaPods/Specs.git' line in Podfile

Then run below commands

pod repo remove trunk
sudo gem install cocoapods-deintegrate cocoapods-clean
pod deintegrate
pod cache clean --all
sudo gem uninstall cocoapods
sudo gem install cocoapods
pod install or pod update

Upvotes: 6

M. Waris
M. Waris

Reputation: 11

i have tried all above options but nothing fixed my issue. i just switched my internet connection to other service provider and then try pod install and trunk url issue was no more there. so try to switch internet connection if facing trunk url issue.

Upvotes: 0

SoftDesigner
SoftDesigner

Reputation: 5853

After checking all the answers and using VPN just to update pods, I've tried:

pod repo remove trunk
pod repo remove master
sudo rm -rf ~/.cocoapods/repos
pod update

I'm not specifying this BTW:
source 'https://cdn.cocoapods.org/'

And all worked.

Upvotes: 9

Glymaxus
Glymaxus

Reputation: 39

On all of those comments; nothing worked for me So i found this and it worked perfectly for me :

pod cache clean --all

pod setup

Upvotes: 4

Aleksey Potapov
Aleksey Potapov

Reputation: 3793

For those, who faced with the following:

[!] CDN: trunk Repo update failed - 1 error(s): CDN: trunk URL couldn't be downloaded: https://...podspec.json Response: 429 429: Too Many Requests

You should remove Podfile.lock, Pod folder and reconnect to your VPN (if any) then run

pod install --repo-update

Upvotes: 6

ankitjaiswal
ankitjaiswal

Reputation: 5103

I got it working by using below commands:

  1. pod repo remove trunk
    and then

  2. pod install or pod update

Upvotes: 465

Pradeep Reddy Kypa
Pradeep Reddy Kypa

Reputation: 4022

Remove Podfile.lock and try re-installing the Pods again (pod install). This worked for me.

Upvotes: 6

Kate M
Kate M

Reputation: 488

Several of these solutions didn't work for me but it was successful with updating the pods once I disconnected from AnyConnect VPN.

Upvotes: 1

gcharita
gcharita

Reputation: 8347

Based on this github comment: whenever cocoapods CDN not working due to DNS issues, try adding directly the url that cdn.cocoapods.org redirects to, as a source in the top level of your Podfile:

source 'https://cocoapods-cdn.netlify.app/'

Upvotes: 5

ViruMax
ViruMax

Reputation: 1218

Tried many solutions from here and there but what worked in my case is:

gem uninstall cocoapods 
gem cleanup
sudo gem install cocoapods -n /usr/local/bin

Hope it works for you!

Upvotes: 1

Zgpeace
Zgpeace

Reputation: 4477

Step one. Remove trunk & master

pod repo remove trunk
pod repo remove master

Step two. Add source in podfile.

source 'https://github.com/CocoaPods/Specs.git'
source 'https://cdn.cocoapods.org/'

Step three. Run pod update. Solve my problem.

pod update --verbose

Upvotes: 19

Eugene
Eugene

Reputation: 231

I fixed it by this solution Add this to your Podfile:

source 'https://cdn.cocoapods.org/'

Afterwards, run the following command to remove it from your managed repo list (in console):

pod repo remove master

Cheers!

Upvotes: 15

Naval Hasan
Naval Hasan

Reputation: 1520

I spend hours by uninstalling and reinstalling pods, Connecting and disconnecting wifi, and trying out different solutions I could find from the internet. And nothing worked. Finally I decided to restart my Macbook and the problem solved. So before trying the solutions given above, I would strongly recommend you to try restarting your system.

Upvotes: 14

Eduard
Eduard

Reputation: 310

Just try this in your terminal:

sudo gem install cocoapods

Upvotes: 11

Related Questions