Skip to main content

CocoaPods Repositories

CocoaPods is a dependency manager for Swift and Objective-C Cocoa projects.

Support Information

  • CocoaPods client support: 1.7.2 and greater

  • Cocoapods client OS: MacOS

  • Spec repositories: CDN only. The content delivery network mirror of the master specs repository is as follows.

    https://cdn.cocoapods.org/

    It is possible to work with custom Specs repositories only after CDN mirror creation.

  • Pods repositories: GoogleSource.com (Git at Google), Bitbucket, direct http(s) link to archive with source code

  • SSL: CocoaPods client can only work with CDN mirror by https protocol. Http protocol is not supported. See configuration details for more about setting up SSL in Nexus Repository.

  • Authentication to remote resources: authentication to remote CDN spec repositories and pod repositories is not supported.

Proxying CocoaPods Repositories

CocoaPods proxy repositories cache metadata .podspec.json files from CDN mirrors of specs repositories. Links to such mirrors are configured in the Remote storage field. After fetching of Spec file, Nexus Repository parses the source link from the metadata file. Such sources can be GitHub, BitBucket or direct https link. Pod library source code will be cached as an archive file such as tar.gz or zip. Https source will be downloaded directly while in the case of GitHub or BitBucket source, the Pod library will be downloaded by REST API call.

To proxy a CocoaPods repository, you simply create a new CocoaPods (proxy).

Use the following configuration steps:

  • Define the proxy name.

    cocoapods-proxy
  • Set the URL for remote storage.

    https://cdn.cocoapods.org/
  • Select a blob store for storage.

Configure CocoaPods Client

In Swift or Objective-C Cocoa project source folder, update Podfile and set the source as a link to Nexus Repository CocoaPods repository. Example:

$cat Podfile
require 'cocoapods'
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
source 'https://localhost:8443/repository/cocoapods-proxy/'
target 'CocoaPodsTest' do
use_frameworks!
  
pod 'Alamofire', '~>5.0.0-beta.5'
pod 'Igor'
pod 'SafetySDK'
pod 'DSTestDR'
end

Configure SSL

CocoaPods client can work with CDN mirror only by https protocol. One of two points below should be configured:

  • Configure Nexus Repository to use trusted SSL certificate. Self signed ones will not work.

  • As the CocoaPods client uses the curl command to download Pod files from Nexus Repository, setup curl to work with self signed certificates by adding the --insecure option into the .curlrc file at your home directory. If no such file exists, then just create it. Example:

$cat ~/.curlrc
--insecure

Set the GIT_SSL_NO_VERIFY=true environment variable when using untrusted certificates.

Configure Nexus Repository Authentication

The CocoaPods client uses curl to download Pod files from the Nexus Repository. You must provide authentication in the request when anonymous access is not enabled.

Set the login and password in the .netrc file in the home folder of your workstation. Use the themache option to configure the hostname or IP address.

Create the .netrc file in the following format when not present:

$cat ~/.netrc
machine localhost
login admin
password admin123
  • Due to limitation in the Spec file access for Cocoapods, Nexus Repository cannot not enforce authentication on Spec files. An informed user could list the contents of proxy repositories without authenticating.

    See the CocoaPods project for more information.