misonoteApp Center

Swift Package Manager cache on Mac: safe to delete?

Safe to deleteRegenerated automatically; Thermo deletes it outright.

Where it is

  • ~/Library/Caches/org.swift.swiftpm
  • ~/Library/org.swift.swiftpm/collections.json

What it is

Swift Package Manager, used by both Xcode and the swift command-line tools, keeps a shared cache of the package repositories it has cloned so projects can resolve dependencies without cloning everything again. A separate file stores package collection data.

Why it gets so big

Cached repositories include their git history, and the cache keeps one for every package any project has resolved, even after you've stopped using it.

Is it safe to delete?

Yes. Xcode and SwiftPM clone packages again the next time a project resolves its dependencies, which needs network access and can take a while for big dependency graphs. Each project's own build folder and Xcode's DerivedData package checkouts are separate from this cache.

Tip

If Xcode gets stuck resolving packages, clearing this cache together with Reset Package Caches in Xcode's File > Packages menu is a common fix.

See how much space it uses

du -sh "$HOME/Library/Caches/org.swift.swiftpm" "$HOME/Library/org.swift.swiftpm/collections.json" 2>/dev/null

Clean it with the tool’s own command

swift package purge-cache

Delete it by hand

Run in Terminal. Deleting cannot be undone, so check the paths first.

rm -rf "$HOME/Library/Caches/org.swift.swiftpm"/*
rm -rf "$HOME/Library/org.swift.swiftpm/collections.json"