Swift Package Manager and CocoaPods caches on a Mac: what rebuilds and what to clear

By the Zofle team · 14 November 2026 · 4 min read

Bars: CocoaPods cache 1.13 GB, React-Core-prebuilt 641 MB, SwiftPM cache 244 MB

Swift Package Manager (SwiftPM) and CocoaPods both keep a copy of every dependency you have ever built against, outside your project. On the Mac we measured (macOS 27.0.1, Swift 6.4, CocoaPods 1.16.2, 14 November 2026) that was 1.13 GB for CocoaPods and 244 MB for SwiftPM. Both are caches: they come back on the next build, at the price of a download. Here is where they are, what's inside, and the commands that clear them.

Where each one lives, with our sizes

PathWhat it isOur size
~/Library/Caches/org.swift.swiftpm/repositoriesOne bare git clone per package you have resolved244 MB (1 repository)
~/Library/Caches/org.swift.swiftpm/manifests and package-collection.dbParsed manifests, package collection indexabout 0.2 MB
~/Library/org.swift.swiftpmSwiftPM configuration and security settings16 KB. Keep it
~/Library/Caches/CocoaPods/PodsDownloaded pod sources (External = pods from git or http sources, Release = from the spec repo)1.13 GB (External 1,181,664 KB; Release 604 KB; Specs 56 KB)
~/.cocoapods/reposLocal copy of the CocoaPods spec index (trunk)9.3 MB
~/Library/Developer/Xcode/DerivedData/<project>/SourcePackagesXcode's own checkouts of packages for a projectnone on this Mac (DerivedData was empty)

CocoaPods: what 1.13 GB looks like

All of ours came from the External folder: pods that a project pulls straight from a git or http source, which CocoaPods caches by a hash of the source. Seven pods, and one of them is more than half:

Pod in ExternalSize
React-Core-prebuilt640.6 MB
ReactNativeDependencies306.3 MB
hermes-engine101.1 MB
ExpoModulesCore77.8 MB
ExpoFileSystem20.7 MB
ExpoFont4.3 MB
ExpoModulesWorklets3.3 MB

<code>pod cache list</code> showed 12 cached versions across those 7 pods, for example two builds of ExpoFileSystem (58.0.10 and 58.0.11) kept side by side. Each upgrade of a React Native or Expo app adds another copy of these prebuilt frameworks and nothing removes the old one. That is how a cache like this creeps up with each SDK bump.

bash
du -sh ~/Library/Caches/CocoaPods
pod cache list                 # every cached pod and version, with its path
pod cache clean NAME           # one pod (asks which version if several)
pod cache clean --all          # the whole cache

The <code>--all</code> flag is deliberate: without it, CocoaPods refuses to clear everything. After clearing, the next <code>pod install</code> downloads what each project needs again. With React Native pods that is the 640 MB prebuilt download, so clear the cache when you are on a fast connection, not before a flight. The index in <code>~/.cocoapods/repos</code> is only 9.3 MB and not worth touching.

SwiftPM: one bare clone per package

SwiftPM keeps a bare git clone of each package it resolves, then checks out the version you need. Our single cached package, a library hosted on GitHub, was 244 MB, mostly git history. A project with 20 packages can have 20 of these.

bash
du -sk ~/Library/Caches/org.swift.swiftpm/repositories/* | sort -rn
swift package purge-cache      # clears the global repository cache

<code>swift package purge-cache</code> is the supported command: its own help text says "Purge the global repository cache". In Xcode the equivalent is the <b>File &gt; Packages</b> menu with <b>Reset Package Caches</b>. Xcode also keeps a per-project checkout under DerivedData, so a project that misbehaves after a purge may also need <b>Reset Package Caches</b> or its DerivedData folder removed.

What clearing costs, and what it doesn't

  • No source code of yours is touched. Both folders are downloaded copies of other people's code.
  • The next build needs the network. Each package or pod is fetched again, once per version.
  • Pinned versions stay pinned. Package.resolved and Podfile.lock in your project decide the versions; the caches only store the download.
  • Don't delete half a folder by hand. Use the commands above; a partly deleted bare clone can make SwiftPM fail until you purge.

If you are clearing for a bigger reason, the Xcode side (simulators, DerivedData, archives) is in <a href="/articles/xcode-ios-simulators-storage-safe-cleanup">Xcode and iOS Simulators</a>, and node and Gradle caches are in <a href="/articles/developer-caches-gradle-node-modules-that-fill-your-disk">Developer disk hogs</a>.

Zofle, our free Mac app, lists developer caches such as CocoaPods and package caches with their size, so you can clear the ones that rebuild.

Download Zofle for Mac

Sources

  • Our own read-only measurements (du, pod cache list, swift package purge-cache --help) on one Mac, 14 November 2026. Nothing was deleted for this article.
  • CocoaPods: pod cache clean --help (CocoaPods 1.16.2).

Zofle Pro news

People signing up now will get Zofle Pro, with more features, for free when we launch it.

One email when it's ready. No spam, ever.