105

I'm following an internet tutorial on Firebase and as part of it, I had to do some work on the command line. I'm pretty comfortable with the command line, but I'm unfamiliar with Cocoapods. I ran pod repo update but after doing so I realized I ran it on my entire Documents folder of my Mac instead of the folder that contained my project. I took over 20 mins to execute and it printed out literally thousands of things when it finally completed, some of which included "create" and "deleted". I was kind of concerned- would run this command have modified anything in my Documents besides the Firebase project? And what does pod repo update even do for that matter?

A Tyshka
  • 3,830
  • 7
  • 24
  • 46
  • 3
    @Roope I did read that documentation. I just wasn't clear what would happen since there wasn't a podfile right in the Documents folder, it was buried in several layers of folders. – A Tyshka Apr 30 '17 at 00:13

2 Answers2

136

As per the documentation pod repo update updates the spec repos located at ~/.cocoapods/repos in your home folder.

Updates the local clone of the spec-repo NAME. If NAME is omitted this will update all spec-repos in ~/.cocoapods/repos.

The repo is basically a list of all pods and versions available. I have just encountered an error in our CI builds because the repo did not include a spec for a library I have just added. By running pod repo update it now knows of this newer version and can continue to install it.

So to answer your question.. Running pod repo update in your documents folder will not do anything in that folder. It will update its pod spec references in your ~/.cocoapods/repos folder only.

Scriptable
  • 19,402
  • 5
  • 56
  • 72
  • if we don't use source control we dont need to call repo update ? just pod install? – isJulian00 Nov 30 '18 at 02:19
  • 2
    Yes you still need to call pod repo update, cocoapods downloads the repo details, it doesn’t matter whether you use source control in your project or not, it needs to load the list of pods and their versions – Scriptable Nov 30 '18 at 11:02
  • im using amazon ad network and admob ad network do you know why amazon tells me to just run "pod install" and admob tells me "pod install --repo-update", sorry Im a bit new to this, when you say cocoapods needs to download the repo details, what exactly is "repo details" ? – isJulian00 Nov 30 '18 at 16:03
  • im not sure what exactly "repo" is – isJulian00 Nov 30 '18 at 16:16
  • 8
    Cocoapods maintains a list (repo) on all pods, their github release links, info etc online and this gets downloaded/indexed in the `~/.cocoapods/repos` folder. So when you install it it will get the current list of pods/libraries available. a few months down the line and say Swift updates to a new version, then you want the updated pod that supports that swift version. but your local cocoapods does not know about this updated version. so you run pod repo update and cocoapods updates its list of libraries available – Scriptable Nov 30 '18 at 18:28
  • if I remove a pod from my podfile want command do I need to run in order for it take effect ? – isJulian00 Dec 01 '18 at 17:44
  • 1
    nothing, just run a build, it wont include that library when doing the build – Scriptable Dec 02 '18 at 02:39
  • do you know what "platform :ios, '12.0' " should be? is it suppose to be set to the deployment target we have set in build settings ? – isJulian00 Dec 17 '18 at 00:03
  • 1
    @izzyMachado it should be the lowest iOS version that you support. for a new project your probably fine to leave it as 12. – Scriptable Dec 17 '18 at 08:12
  • ok thanks, do you know if are project settings for 'bitcode enabled' override cocoapod settings for 'bitcoade enabled' ? im using a game engine that has bitcode enabled = no, and I added cocoapods and it is default bitcode enabled = yes , everything is building fine just wondering if it overrides or how it deals with it ? – isJulian00 Dec 18 '18 at 02:51
  • I'm not sure sorry, best to check the documentation – Scriptable Dec 18 '18 at 08:04
  • "The repo is basically a list of all **pods** and versions available" <-- I think your wording isn't accurate. The repo is basically a list of all distinct podspecs, by distinct I mean each version of the podspec unde a tag folder. It doesn't contain the pod itself. See [all public specs](https://github.com/CocoaPods/Specs/tree/master/Specs) then [multiple versions of a specific spec e.g. CWNotificationBanner](https://github.com/CocoaPods/Specs/tree/master/Specs/0/0/0/CWNotificationBanner). The repo is updated if a new tag exists – mfaani Aug 12 '19 at 20:07
  • Hi Honey, thanks for the additional information, I wasn't trying to be technically accurate but easy to understand, hence the 'basically a list....' it was a simplification :) – Scriptable Aug 13 '19 at 07:06
18

The main Specs repo is nothing but a list of ALL PodSpecs. A PodSpec is:

A specification describes a version of Pod library. It includes details about where the source should be fetched from [which tag or commit or branch], what files to use, the build settings to apply, and other general metadata such as its name, version, and description.

The specs directory is nothing but a list of all distinct PodSpecs. Each version of the PodSpec is under a tag directory. The repo doesn't contain the pod itself. The repo contains the PodSpec. The PodSpec gives the location of the repo and a bunch of other meta data⚡︎

spec.source = { :git => 'https://github.com/tonymillion/Reachability.git', :tag => 'v3.1.0' }

When you do pod repo update, you're pulling the latest PodSpecs (not the actual pod) from https://github.com/CocoaPods/Specs. If you want to only update an individual pod source, then just do pod repo update [NAME]

Cocoapods/Specs master repo:

enter image description here

The list of some Alamofire PodSpecs

enter image description here

A single PodSpec 4.7.3:

enter image description here


⚡︎: PodSpec: A specification describes a version of Pod library. It includes details about where the source should be fetched from, what files to use, the build settings to apply, and other general metadata such as its name, version, and description.


Your actual project pulls in the code through either pod update or pod install then the physical files get downloaded to your mac and copied for your project.

Often you'd get this error:

None of your spec sources contain a spec satisfying the dependencies: AlamoFire (= 11.0.3), AlamoFire (= 11.0.3).

You have either: * out-of-date source repos which you can update with pod repo update or with pod install --repo-update. * mistyped the name or version. * not added the source repo that hosts the Podspec to your Podfile.

Spec sources is what's important. It just means you haven't pulled in the specs. You can easily see spec sources you have by doing pod repo. Mine is:

cocoapods
- Type: git (remotes/origin/master)
- URL:  https://github.com/CocoaPods/Specs.git
- Path: /Users/mfaani/.cocoapods/repos/cocoapods

private_pods
- Type: git (master)
- URL:  git@github.company.com:xyz/private_Cocoapods.git
- Path: /Users/mfaani/.cocoapods/repos/private_cocoapods

trunk
- Type: CDN
- URL:  https://cdn.cocoapods.org/
- Path: /Users/mfaani/.cocoapods/repos/trunk
mfaani
  • 33,269
  • 19
  • 164
  • 293