Is it safe to delete CocoaPods’ cache and a project’s Pods folder?
- Yes, all three come back with
pod install. The cache is downloads,~/.cocoapods/reposis spec indexes, andPodsis whatpod installset up for one project. KeepPodfileandPodfile.lock. - What it costs you: the project won’t build until you run
pod install, which downloads whatever is no longer cached. - Does it come back? Yes, at the versions recorded in
Podfile.lock. - SiftMac’s verdict: Rebuilds
1. Three different folders
- **
~/Library/Caches/CocoaPods** is the download cache: a copy of every pod version CocoaPods fetched, so another project using the same pod installs without downloading it. - **
~/.cocoapods/repos** holds spec repositories, the indexes CocoaPods resolves pods from. Since CocoaPods 1.8 the default source is the CDN, calledtrunk, and the oldmasterspecs repo, a full Git clone, is no longer needed. - **
Pods** sits in each project next to thePodfile: the pods installed for that project and the generatedPods.xcodeproj, which your app builds against through its.xcworkspace.
Podfile.lock records the version of each pod that was installed, and pod install downloads exactly those versions without checking for newer ones. That’s what makes a deleted Pods folder come back as it was.
2. Where they are
~/Library/Caches/CocoaPods
~/.cocoapods/repos
~/Projects/MyApp/Pods
CP_CACHE_DIR, CP_HOME_DIR and CP_REPOS_DIR move the first two. pod cache list shows the cache pod by pod, and pod repo list lists your spec repos.
3. How big they get
du -sh ~/Library/Caches/CocoaPods ~/.cocoapods/repos/*
du -sh ~/Projects/MyApp/Pods
The cache grows with every pod version any project installed. If ~/.cocoapods/repos/master exists, it’s the full Git clone that CocoaPods’ own 1.8 announcement called huge, and nothing needs it once your projects use the CDN.
4. How to clear each one
The download cache
pod cache clean --all
Without a pod name, --all is required, so the whole cache can’t be emptied by accident. pod cache clean <name> removes a single pod.
The old master specs repo
If pod repo list shows master and your Podfile uses the CDN source or names no source at all, remove it:
pod repo remove master
A project’s Pods folder
Close the workspace in Xcode, then check Git. CocoaPods recommends keeping Pods under source control, so in many projects Git tracks it: deleting it shows up as changes, and git restore Pods brings it back. If it’s ignored, delete it and reinstall:
rm -rf ~/Projects/MyApp/Pods
cd ~/Projects/MyApp
pod install
5. What happens afterwards
- Until
pod installruns, Xcode can’t find the pods and the build fails with missing modules or files. pod installrestores the versions inPodfile.lock, from the cache where it can and from the network for the rest.- Emptying the cache only costs download time on the next install; projects that still have
Podskeep building. - Removing
masterchanges nothing for projects that resolve from the CDN.
Questions
Is it safe to delete Podfile.lock?
Don’t. It pins every pod to the version you built and tested with. Without it, pod install resolves versions from the Podfile again and may pick newer ones. CocoaPods says to always commit it.
Should I run pod deintegrate to free space?
No. pod deintegrate removes every trace of CocoaPods from your Xcode project. To free space, delete Pods or clean the cache; both come back with pod install.
What is ~/.cocoapods/repos/trunk?
The CDN spec source CocoaPods uses by default since 1.8. It’s an index of pod specs, not the pods themselves, and pod repo list shows it.
How SiftMac handles it. Its App caches category clears ~/Library/Caches/CocoaPods with a Rebuilds verdict. Under Developer files it lists Pods folders that sit next to a Podfile, in projects you haven’t changed for 1, 3 or 6 months, as CocoaPods packages that pod install brings back; none is ticked until you tick it.
Download SiftMac · scanning is free, and so is your first 2 GB of cleaning · See how it works