Where apps hide your files
CocoaPods spreads its files over two places in your home folder: a cache of downloaded pod sources and a spec repo. Both can be cleared safely, and this page shows which command does it.
~/Library/Caches/CocoaPods (downloaded pod sources, the download cache)
~/.cocoapods/repos (spec repos, such as the trunk CDN)
The cache path is CocoaPods' default: cache_root in the gem's own config.rb is ~/Library/Caches/CocoaPods, and pod cache list prints the exact folder it is using (on the Mac used for this guide it reported ~/Library/Caches/CocoaPods/Pods). The .cocoapods folder starts with a dot, so Finder hides it.
To open either one, choose Go > Go to Folder (or press ⇧⌘G) and paste the path, or from Terminal:
open ~/Library/Caches/CocoaPods
open ~/.cocoapods/repos
CocoaPods creates ~/Library/Caches/CocoaPods the first time a command needs it (even pod cache list does), so a missing or nearly empty cache just means nothing has been downloaded through it yet. On the Mac used for this guide it held only a Pods folder with a VERSION file, while ~/.cocoapods/repos held the trunk specs, so the two fill up independently.
| Location | What it is |
|---|---|
~/Library/Caches/CocoaPods/Pods | The download cache: one entry per pod version you have installed, so the next pod install does not fetch it again. |
~/.cocoapods/repos/trunk | The local copy of the CocoaPods trunk spec source. |
~/.cocoapods/repos/trunk/Specs | Podspec files for the pods your projects have asked about, sharded into nested single-character folders (0 to 9, a to f). |
~/.cocoapods/repos/trunk/all_pods_versions_*.txt | Index files with .etag companions, used to check what is new on the CDN. |
~/.cocoapods/repos/Spec_Lock | An empty lock file that stops two pod commands updating the repos at once. Leave it. |
~/.cocoapods/templates | If you create Podfile.default or Podfile.test here, pod init starts from them. |
Since CocoaPods 1.8 the default trunk source is a CDN, not a full clone of a Git repository. pod repo list shows this: on the Mac used for this guide it listed one repo, trunk, with type CDN, the URL https://cdn.cocoapods.org/ and its path under ~/.cocoapods/repos. Because only the specs you needed are fetched, that folder stayed at about 30 MB here, far smaller than a full clone of the old Git repo. If yours is much larger, you may still have an old Git-based master repo from before the switch.
du -sh ~/Library/Caches/CocoaPods ~/.cocoapods
pod cache list --short
pod cache list prints a YAML tree of the cache, grouped by pod. Add a pod name to see just that one. Neither command changes anything.
Use CocoaPods instead of Finder:
pod cache clean <PodName>
pod cache clean --all
With a name, CocoaPods removes that pod's cache and asks which version if several are cached. Without a name you must add --all, which exists to stop you wiping everything by accident. The cost of clearing the cache is only time and bandwidth: the next pod install downloads what it needs again. If you prefer Finder, quit Xcode and any terminal running pod, then move ~/Library/Caches/CocoaPods to the Trash.
If pod install complains about a missing or stale spec, update or rebuild the repo instead of editing files inside it:
pod repo update
pod repo remove trunk
pod repo update refreshes all repos (or one, if you give its name). pod repo remove trunk deletes the local copy, and CocoaPods fetches it again on the next install. Do not delete individual files inside Specs; the index files and specs are meant to match.
Neither folder above is the Pods/ directory next to your .xcworkspace. That one is part of your project: it holds the sources and generated project that Xcode actually builds, copied out of the cache. Deleting it is safe if you run pod install afterwards, but it is not where the shared cache lives. If you want to detach a project from CocoaPods completely, CocoaPods provides pod deintegrate for that.
Build products are a third place. Xcode's compiled output for your pods lands in DerivedData, covered in where Xcode keeps DerivedData.
There is nothing here worth backing up. The cache is rebuilt from the network and the specs come from the CDN. What matters for reproducing a build is your Podfile and Podfile.lock, which live in the project. The cache can move. CocoaPods' source (lib/cocoapods/config.rb) reads a CP_CACHE_DIR environment variable, or a cache_root: line in ~/.cocoapods/config.yaml. CP_HOME_DIR moves ~/.cocoapods itself, and then the cache defaults to a cache folder inside it. After setting one, pod cache list shows the folder in use.
CocoaPods itself is a Ruby gem, and the paths above are in your home folder, so they are the same on both architectures. What differs is where the pod command lives: /usr/local/bin/pod for a system Ruby gem install (as on the Mac used for this guide) or /opt/homebrew/bin/pod for an Apple silicon Homebrew install. which pod tells you which one you are running.
Spotlight and Finder searches leave out ~/Library/Caches and hidden dot-folders such as ~/.cocoapods, so typing a pod name into Finder finds nothing even when ten versions are cached.
Everywhere indexes file names inside caches and hidden folders, so typing a pod name such as Alamofire or a podspec file name such as .podspec.json lists the matching folders and spec files under ~/.cocoapods and the cache. The ~/Library/Caches part is indexed in the normal scan; it searches names only, not the code inside. Press ⌘↵ to reveal a result in Finder.
In ~/Library/Caches/CocoaPods, with downloaded pods under its Pods subfolder. Run pod cache list to see the exact paths it is using.
In ~/.cocoapods/repos. The default trunk source is a CDN, so ~/.cocoapods/repos/trunk only holds the specs your projects have needed, not a full clone.
Run pod cache clean --all, or pod cache clean <PodName> for one pod. The next pod install downloads whatever it needs again.
Mostly. The trunk specs come back from the CDN on the next pod install, but you lose any private spec repos added with pod repo add and any config.yaml or templates you made there. Quit anything running pod first.
Everywhere keeps track of every file on your Mac — including the folders Spotlight hides and drives you have unplugged. Free for a day, then $19 once.
Version 2.20.3 · macOS 13+ · 4.7 MB · notarised