Deleting the SwiftPM cache is safe: Swift Package Manager rebuilds every file in ~/Library/Caches/org.swift.swiftpm on the next resolve. What you pay is the download. On my Mac 4.7 GB of the folder’s 5.4 GB were binary frameworks, and every one of them would download again.
Main rule: quit Xcode first, and clear the artifacts folder when you need the space. It holds most of the size and comes back on demand.
Quick answer
- Measure with
du -sh ~/Library/Caches/org.swift.swiftpm/*. - Quit Xcode and stop any running
swift build. - Move
artifacts, or the whole folder, to the Trash. - Open the project again and let it resolve packages.
- Expect the first resolve to download for a while.
- If Xcode shows package errors afterwards, run File, Packages, Reset Package Caches.
What lives in the folder
I measured the cache on 25 October 2026 on my Mac, with Swift 6.4 and Xcode 27.1:
| Subfolder | What it holds | On my Mac |
|---|---|---|
artifacts | downloaded binary targets, zipped .xcframework files | 4.7 GB, 46 items |
repositories | git clones of package repositories | 469 MB, 23 items |
manifests | cached results of evaluating Package.swift | 256 MB |
prebuilts | prebuilt binaries | 19 MB |
The folder name follows the bundle identifier convention of ~/Library/Caches, so you find it next to app caches, not in ~/Library/Developer with the rest of Xcode’s storage.
Why binary artifacts take most of the space
A package can ship a framework as a prebuilt .xcframework instead of source code. SwiftPM downloads the zip and keeps it in artifacts, one entry per release and variant.
On my Mac 45 of the 46 artifacts came from one SDK, sentry-cocoa. Seven releases sat side by side, from 9.5.1 to 9.31.0, and each release added several variants: static, dynamic, without UIKit or AppKit, with arm64e. Together they took 4.7 GB. The 23 source repositories next to them took 469 MB.
Run this to see which releases your cache holds:
ls ~/Library/Caches/org.swift.swiftpm/artifacts
The entry names contain the download URL, so the SDK and version are readable.
What happens after you delete it
- The next resolve downloads again. Opening a project in Xcode,
swift package resolve, orswift buildclones the repositories and downloads the artifacts it needs. On a slow connection, budget time for it. - Your versions stay the same. Each project’s
Package.resolvedpins the versions, and the resolve uses those pins. - Offline, the resolve fails. Projects build again once the package hosts are reachable.
- Per-project copies stay. Xcode keeps checkouts for each project in DerivedData, in a
SourcePackagesfolder inside the project’s folder. On my Mac one project’s copy took 240 MB. Deleting the global cache does not touch it, and deleting DerivedData does.
How to clear it
Only the old releases. Compare the versions in the artifacts names with the Package.resolved files of the projects you work on, and move the older entries to the Trash. You keep the current downloads and lose the dead weight.
The whole artifacts folder. Quit Xcode, then move ~/Library/Caches/org.swift.swiftpm/artifacts to the Trash. This frees the most space for the least re-download of source code.
The whole cache. Move ~/Library/Caches/org.swift.swiftpm to the Trash, or run swift package purge-cache. Its help text describes it as “Purge the global repository cache.” Measure the folder afterwards to see what it removed.
Empty the Trash once your projects resolve and build again.
Bottom line
Deleting the SwiftPM cache breaks nothing, and refilling it costs a long download when binary frameworks dominate it. Quit Xcode, look inside artifacts, drop the releases your projects no longer pin, and clear the whole folder only when you can afford the download.
Frequently asked questions
Is it safe to delete ~/Library/Caches/org.swift.swiftpm?
Yes. Everything in it comes back on the next package resolve. The cost is the download: package repositories get cloned again and binary frameworks download again, which can mean several gigabytes.
Will deleting the SwiftPM cache change my package versions?
No. Your projects keep their Package.resolved files, so the next resolve fetches the same versions you had pinned.
Why is my SwiftPM cache so big?
Binary artifacts. SDKs that ship as xcframeworks store one zip per release and variant, and the cache keeps old releases next to new ones. On my Mac 45 of 46 artifacts came from one SDK and took 4.7 of the folder's 5.4 GB.
Is this the same as SourcePackages in DerivedData?
No. Xcode keeps a per-project copy of checked-out packages in DerivedData, in a SourcePackages folder inside each project's folder. Deleting DerivedData removes that copy. Deleting the global SwiftPM cache leaves it in place.
Can I delete the SwiftPM cache while Xcode is open?
Quit Xcode and stop any swift build or swift package command first. A resolve that runs while its cache disappears can fail halfway and leave you with package errors to clear.