CocoaPods, Carthage and SPM: Three Dependency Managers, Three Caches
CocoaPods, Carthage and Swift Package Manager each keep their own cache. Where all three live on a Mac, typical sizes, and what is safe to delete.
iOS development has gone through three dependency managers in a decade, and unlike most software migrations, moving to the new one never cleaned up after the old one.
du -sh ~/Library/Caches/CocoaPods
du -sh ~/Library/Caches/org.swift.swiftpm
du -sh ~/Library/Caches/carthage
If your team migrated from CocoaPods to Swift Package Manager two years ago, there’s a good chance nobody ever went back and cleared the CocoaPods cache — it just sits there, fully inert, taking up 5–15 GB.
CocoaPods: two separate caches, not one
CocoaPods actually maintains two distinct things people conflate:
# The spec repository — metadata for every pod version that exists
du -sh ~/.cocoapods/repos
# The actual downloaded pod source code, cached for reuse across projects
du -sh ~/Library/Caches/CocoaPods
~/.cocoapods/repos is the CocoaPods Trunk spec repo — an index of every published pod and version,
cloned as a git repository. It used to be mandatory and enormous (multiple gigabytes of pure
metadata); CDN-backed CocoaPods installs since 1.7 don’t need it at all. If you’re not sure, check
whether you have a legacy source 'https://github.com/CocoaPods/Specs.git' line in your Podfile —
if not, this entire directory is dead weight:
rm -rf ~/.cocoapods/repos
~/Library/Caches/CocoaPods is the actual pod source cache — safe to clear the same way any package
manager cache is safe to clear, at the cost of re-downloading on your next pod install:
rm -rf ~/Library/Caches/CocoaPods
pod cache clean --all # the supported way to do the same thing
Carthage: probably dead weight if you haven’t used it in a year
Carthage lost the popularity contest to SPM years ago, which means for most iOS developers this cache is pure archaeology — built once, never touched since, never cleared:
du -sh ~/Library/Caches/carthage
du -sh ~/Library/Caches/org.carthage.CarthageKit
If no project on your machine has a Cartfile anymore, both are safe to delete outright. Carthage
itself will rebuild them from scratch the rare time you touch a legacy project that still uses it.
Swift Package Manager: the one you’re using now
SPM’s cache is the one actively growing on a modern iOS or Mac project:
du -sh ~/Library/Caches/org.swift.swiftpm
du -sh ~/Library/org.swift.swiftpm # newer Xcode versions moved it here
This holds cloned package repositories and their resolved artifacts. Safe to delete — Xcode re-clones and re-resolves on next build, which for a project with many dependencies can take a couple of minutes over the network, once:
rm -rf ~/Library/Caches/org.swift.swiftpm
Xcode also has its own File → Packages → Reset Package Caches menu item, which does roughly the same thing scoped to the currently open project — use it if you’d rather not touch the shell.
What to actually check before deleting anything here
Unlike DerivedData, these caches are genuinely tied to what your current projects use — deleting
CocoaPods’ cache when you have three actively-maintained CocoaPods projects means all three
re-download on your next pod install, which is a real (if one-time) cost. Check what you’re still
using:
# Find every project on disk still using each dependency manager
find ~ -name "Podfile.lock" -not -path "*/Pods/*" 2>/dev/null
find ~ -name "Cartfile.resolved" 2>/dev/null
find ~ -name "Package.resolved" 2>/dev/null
If Cartfile.resolved turns up nothing, Carthage’s caches are unambiguously safe to remove — nothing
on this machine will ever read them again until you deliberately start a new Carthage-based project.
DevCruft, the free Mac app for developers we’re working on, is being designed to track which dependency managers your actual projects use and only flag a cache as reclaimable once nothing on disk still depends on it. It’s still in development, so for now run the commands above — they’re free and they work. Get on the waitlist to find out when it’s ready.
For the rest of the Xcode-adjacent hoards — DerivedData, Archives, and Simulators — see the Xcode DerivedData guide and the iOS Simulator cleanup guide.