What is the CocoaPods cache, and is it safe to delete?

The CocoaPods cache stores downloaded pod sources and specs so repeat installs are fast, and it is safe to clear because pod install fetches them again.

Shiva ChandraMaker of Clean House · · 2 min read
Short answer

The CocoaPods cache is the folder where CocoaPods keeps downloaded pod sources and specs so repeat installs are quick. It is safe to clear. Run pod cache clean --all, or delete the folder, and pod install fetches everything again. Your Podfile and Podfile.lock are not touched.

Path
~/Library/Caches/CocoaPods
What it is
Downloaded pod sources and specs reused across projects
Typical size
From hundreds of megabytes to several gigabytes on Macs with many iOS projects
Made by
CocoaPods
Safe to delete?
Safe to clear
Comes back?
Yes, pod install downloads what it needs again

What is in this folder?

When you run pod install, CocoaPods downloads each pod into this cache and copies it into your project's Pods folder. The cache saves time and bandwidth when several projects use the same pod.

The cache is separate from the Pods folder in your project and from the spec repositories under ~/.cocoapods.

Is it safe to delete?

Yes. Everything here can be downloaded again, and your Podfile.lock pins the versions you use. The trade-off is time: the next install downloads each pod once more. Do not clear it if you are offline or on a slow connection.

Old projects whose pods were removed from the registry may fail to install after clearing, so if you rely on an archived pod, keep it.

How do I clear it by hand?

  1. Close Xcode and stop any running pod command.
  2. Run the command below. Without --all it asks you to name a pod.
  3. Run pod install in a project to fetch what it needs.
pod cache list
pod cache clean --all
Prefer the pod command to deleting the folder. Do not delete a project's Pods folder unless you are ready to run pod install again.

How do I stop it growing?

It grows as you try new pods and versions. Clearing it a few times a year is enough.

How Clean House handles it

Clean House recognizes the CocoaPods cache as downloaded iOS libraries, made by CocoaPods, and marks it as something that downloads again. You see that in the Why card, and files go to the Trash first.

Questions

Is it safe to delete the CocoaPods cache?

Yes. pod install downloads pods again. Your Podfile.lock still pins the versions.

What is the command to clear the CocoaPods cache?

pod cache clean --all removes every cached pod without asking.

Is the cache the same as the Pods folder?

No. The Pods folder is inside your project. The cache is a shared download store.

Sources

  1. CocoaPods Guides: Command-line reference
  2. CocoaPods Guides: Troubleshooting