others-how to solve `trunk URL couldn't be downloaded,SSL connect error` when using `pod install` to install dependencies for ios/macos(or xcode) apps?

1. Problem

In this post, I will demonstrate how to solve the trunk URL couldn't be downloaded,SSL connect error when using pod install to install dependencies for ios/macos apps, such as follows:



pod install


CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/3/2/5/FlipperKit/0.86.0/FlipperKit.podspec.json Response: SSL connect error
CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/3/2/5/FlipperKit/0.87.0/FlipperKit.podspec.json Response: SSL connect error
CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/3/2/5/FlipperKit/0.88.0/FlipperKit.podspec.json Response: SSL connect error
CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/3/2/5/FlipperKit/0.89.0/FlipperKit.podspec.json Response: Timeout was reached
CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/3/2/5/FlipperKit/0.90.0/FlipperKit.podspec.json Response: Timeout was reached
CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/3/2/5/FlipperKit/0.90.1/FlipperKit.podspec.json Response: SSL connect error
CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/3/2/5/FlipperKit/0.90.2/FlipperKit.podspec.json Response: SSL connect error
CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/3/2/5/FlipperKit/0.91.0/FlipperKit.podspec.json Response: SSL connect error
CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/3/2/5/FlipperKit/0.91.1/FlipperKit.podspec.json Response: SSL connect error
CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/3/2/5/FlipperKit/0.91.2/FlipperKit.podspec.json Response: SSL connect error
CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/3/2/5/FlipperKit/0.92.0/FlipperKit.podspec.json Response: SSL connect error
CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/3/2/5/FlipperKit/0.93.0/FlipperKit.podspec.json Response: SSL connect error
CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/3/2/5/FlipperKit/0.94.0/FlipperKit.podspec.json Response: SSL connect error
CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/3/2/5/FlipperKit/0.94.1/FlipperKit.podspec.json Response: SSL connect error
CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/3/2/5/FlipperKit/0.95.0/FlipperKit.podspec.json Response: SSL connect error
CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/3/2/5/FlipperKit/0.95.1/FlipperKit.podspec.json Response: Timeout was reached
CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/3/2/5/FlipperKit/0.96.0/FlipperKit.podspec.json Response: SSL connect error
CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/3/2/5/FlipperKit/0.96.1/FlipperKit.podspec.json Response: SSL connect error
CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/3/2/5/FlipperKit/0.98.0/FlipperKit.podspec.json Response: SSL connect error
CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/3/2/5/FlipperKit/0.99.0/FlipperKit.podspec.json Response: Timeout was reached



2. Solution

1) What is pod install?

When you call pod install, you are actually installing dependencies for macOs/iOs apps. The pod is a shortcut for ‘cocoapod’, which is defined as follows:

CocoaPods manages library dependencies for your Xcode projects. The dependencies for your projects are specified in a single text file called a Podfile. CocoaPods will resolve dependencies between libraries, fetch the resulting source code, then link it together in an Xcode workspace to build your project.

You can install cocoapods as follows:

$ sudo gem install cocoapods

Then if you want to install dependencies using cocoapods, you should create a podfile at first:

target 'MyApp' do
  pod 'AFNetworking', '~> 3.0'
  pod 'FBSDKCoreKit', '~> 4.9'
end

The above file defines two dependencies for your project,including their names and versions.

Then you can install them as follows:

 $ pod install

But sometimes, we will encounter the following error when running pod install:

CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/3/2/5/FlipperKit/0.86.0/FlipperKit.podspec.json Response: SSL connect error
CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/3/2/5/FlipperKit/0.87.0/FlipperKit.podspec.json Response: SSL connect error
CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/3/2/5/FlipperKit/0.88.0/FlipperKit.podspec.json Response: SSL connect error
CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/3/2/5/FlipperKit/0.89.0/FlipperKit.podspec.json Response: Timeout was reached
CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/3/2/5/FlipperKit/0.90.0/FlipperKit.podspec.json Response: Timeout was reached
CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/3/2/5/FlipperKit/0.90.1/FlipperKit.podspec.json Response: SSL connect error
CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/3/2/5/FlipperKit/0.90.2/FlipperKit.podspec.json Response: SSL connect error
CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/3/2/5/FlipperKit/0.91.0/FlipperKit.podspec.json Response: SSL connect error
CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/3/2/5/FlipperKit/0.91.1/FlipperKit.podspec.json Response: SSL connect error
CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/3/2/5/FlipperKit/0.91.2/FlipperKit.podspec.json Response: SSL connect error
CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/3/2/5/FlipperKit/0.92.0/FlipperKit.podspec.json Response: SSL connect error
CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/3/2/5/FlipperKit/0.93.0/FlipperKit.podspec.json Response: SSL connect error
CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/3/2/5/FlipperKit/0.94.0/FlipperKit.podspec.json Response: SSL connect error
CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/3/2/5/FlipperKit/0.94.1/FlipperKit.podspec.json Response: SSL connect error
CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/3/2/5/FlipperKit/0.95.0/FlipperKit.podspec.json Response: SSL connect error
CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/3/2/5/FlipperKit/0.95.1/FlipperKit.podspec.json Response: Timeout was reached
CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/3/2/5/FlipperKit/0.96.0/FlipperKit.podspec.json Response: SSL connect error
CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/3/2/5/FlipperKit/0.96.1/FlipperKit.podspec.json Response: SSL connect error
CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/3/2/5/FlipperKit/0.98.0/FlipperKit.podspec.json Response: SSL connect error
CDN: trunk URL couldn't be downloaded: https://cdn.jsdelivr.net/cocoa/Specs/3/2/5/FlipperKit/0.99.0/FlipperKit.podspec.json Response: Timeout was reached

2) What is trunk in cocoapods?

CocoaPods Trunk is an authentication and CocoaPods API service. To publish new or updated libraries to CocoaPods for public release you will need to be registered with Trunk and have a valid Trunk session on your current device.

Today we are launching our web-service to remedy the aforementioned problems. The introduction of the ‘Trunk’ web-service means that publishers can now publish Pods directly from the command-line, without the need to create a pull-request.

The first person to publish a pod automatically gets designated as the ‘owner’ of that pod name in the scope of the ‘master’ spec-repo. The ‘owner’ can then add other ‘owners’ as they see fit. Only ‘owners’ are allowed to publish subsequent versions of said pod. For more information on this and interacting with ‘Trunk’ in general, see this guide.

Note that we are still hosting the canonical database of available Pods and their specifications in the same git repo on GitHub. This means that if something were to affect the uptime/stability of this database, our users can rely on GitHub’s professional and 24/7 support. Thus, if ‘Trunk’ were to go down, for whatever reason, our normal users are not affected and only ‘owners’ will be unable to publish new Pods during that time-frame. All in all, this means better stability for you, our users, and less stress on us, the volunteers. A simple overview of our architecture is shown in the following diagram:

So the trunk is a webservice only needed to publish pods, if we only need to download pods, we don’t need it.

3) How to solve the trunk URL couldn't be downloaded,SSL connect error ?

According to the above analysis, we can just remove the trunk from our machine:

➜  pod repo remove trunk
Removing spec repo `trunk`

We got this result:

➜  pod install
Analyzing dependencies
Fetching podspec for `DoubleConversion` from `../node_modules/react-native/third-party-podspecs/DoubleConversion.podspec`
Fetching podspec for `RCT-Folly` from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`
Fetching podspec for `glog` from `../node_modules/react-native/third-party-podspecs/glog.podspec`
Adding spec repo `trunk` with CDN `https://cdn.cocoapods.org/`

CocoaPods 1.11.3 is available.
To update use: `gem install cocoapods`

For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.11.3

Downloading dependencies
Installing CocoaAsyncSocket (7.6.5)
Installing DoubleConversion (1.1.6)

it works!



3. Summary

In this post, I demonstrated how to how to solve trunk URL couldn't be downloaded,SSL connect error when using pod install to install dependencies for ios/macos(or xcode) apps . The key point is to remove the trunk service from our machine. That’s it, thanks for your reading.