I build StorageRadar, a disk space app for macOS. Everything below uses built-in commands, so you can repeat it without the app.
On 25 October I measured my SwiftPM cache for a guide about deleting it. The artifacts folder held 4.7 GB, and 45 of its 46 entries came from one SDK, sentry-cocoa. I checked the folder again on 16 November:
~/Library/Caches/org.swift.swiftpm/artifacts |
25 Oct | 16 Nov |
|---|---|---|
| Size | 4.7 GB | 6.3 GB |
| Entries | 46 | 60 |
| Entries from sentry-cocoa | 45 | 59 |
| Sentry releases | 7 | 9 |
Two Sentry releases arrived in those three weeks and added 1.6 GB. The oldest entry in the folder dates from 20 October.
My setup: Mac mini M4, macOS 27.2.1, Xcode 27.2, Swift 6.4.2. Sizes come from du.
Nine releases, seven builds each
Sentry publishes prebuilt .xcframework zips on its GitHub releases, and SwiftPM keeps one zip per build: the static Sentry, Sentry-Dynamic, Sentry-WithoutUIKitOrAppKit, and arm64e versions of the last two. Newer releases, 9.19.0 onward in my cache, add two SentryObjC builds. One release took 533 MB at 9.5.1 and 834 MB at 9.34.0.
This command sums your cache by package and release, for binaries hosted on GitHub releases:
cd ~/Library/Caches/org.swift.swiftpm/artifacts
du -sk *_releases_download_* \
| sed -E 's/https___github_com_//; s/_releases_download_([0-9]+_[0-9]+_[0-9]+).*/ \1/' \
| awk '{ v = $3; gsub(/_/, ".", v); s[$2 " " v] += $1 }
END { for (k in s) printf "%6.0f MB %s\n", s[k] / 1024, k }' \
| sort -rn
I link one product, and SwiftPM fetched all seven
Eleven of my apps use Sentry, and each links one product. Seven link the static Sentry framework, two link Sentry-Dynamic, and two link SentrySPM. SentrySPM compiles the SDK from source, and Sentry's docs recommend it.
I wrote a scratch package that depends on SentrySPM 9.34.0 and nothing else:
dependencies: [
.package(url: "https://github.com/getsentry/sentry-cocoa", exact: "9.34.0")
],
targets: [
.target(name: "Probe", dependencies: [
.product(name: "SentrySPM", package: "sentry-cocoa")
])
]
swift package resolve printed seven lines like this one, one per binary target in Sentry's Package.swift:
Fetching binary artifact https://github.com/getsentry/sentry-cocoa/releases/download/9.34.0/Sentry-Dynamic.xcframework.zip from cache
I ran it against a copy of my cache with --cache-path, so nothing came over the network. With an empty cache, you download those 834 MB for a product that uses none of them. SwiftPM then unpacked all seven builds into the package's .build/artifacts/sentry-cocoa: 3.3 GB.
Douglas Hill wrote in 2022 that SwiftPM "tries to download all the binary targets of each package", and my test shows Swift 6.4.2 doing the same.
A second copy in DerivedData
The shared cache keeps the zips. Each Xcode project gets its own unpacked copy in SourcePackages/artifacts, inside the project's DerivedData folder. To measure it, I resolved StorageRadar into an empty folder:
xcodebuild -resolvePackageDependencies \
-project StorageRadarMac.xcodeproj \
-clonedSourcePackagesDirPath /tmp/sp
StorageRadar links the static Sentry framework at 9.5.1. Xcode unpacked all five builds of that release, and artifacts came to 2.1 GB. The framework the app links took 280 MB of it.
Unpacked, one Sentry release took 2.1 GB (9.5.1, five builds) and 3.3 GB (9.34.0, seven builds) in my two tests. The zips in the shared cache add 0.5 to 0.8 GB per release on top.
Three releases no project pins
Old releases stay in the cache after a project moves on. I compared the cache with the Package.resolved files in my projects folder:
# point find at the folder that holds your projects
find ~/Developer -name Package.resolved -not -path '*/.build/*' \
-exec grep -h -A6 '"identity" : "sentry-cocoa"' {} + \
| grep -o '"version" : "[^"]*"' | sort | uniq -c
My apps pin eight different Sentry versions. Six of the nine cached releases match a pin, and three don't:
- 9.26.1. My MQTT client moved from it to 9.32.0 on 4 November.
- 9.31.0 and 9.34.0. I found no
Package.resolvedthat pins them. They arrived on 23 October and 13 November, and I can't tell which checkout fetched them.
Together they take 2.3 GB. My current projects won't download anything if I remove them. If I check out an old commit that pins one of them, Xcode downloads it again.
To drop a release, quit Xcode and move its builds to the Trash:
cd ~/Library/Caches/org.swift.swiftpm/artifacts
mv *sentry_cocoa_releases_download_9_26_1_* ~/.Trash/
Skip swift package purge-cache for this. On a copy of my cache it emptied repositories and manifests and left all 60 artifacts in place, 6.3 GB. Its help text names its target: "Purge the global repository cache."
For more space, delete the DerivedData of projects you no longer open. Their unpacked copies weigh more than the zips: 2.1 GB for StorageRadar alone.
Sentry has a lighter package for static builds
Sentry knows about the problem. In issue #7816 a user asked them to cut the package size, and in April a maintainer replied that SwiftPM causes it. The maintainer added that building from source will likely become the default in v10, with the prebuilt binaries moving to a separate repository.
That repository exists: sentry-cocoa-binaries, with tags from 9.24.0 to 9.34.0. Its Package.swift declares two binary targets, Sentry-Static and SentryObjC-Static:
.package(url: "https://github.com/getsentry/sentry-cocoa-binaries.git", exact: "9.34.0")
// in your target:
.product(name: "Sentry-Static", package: "sentry-cocoa-binaries")
I resolved it with the same scratch setup. SwiftPM fetched two zips, 121 MB, and unpacked 546 MB. For the same release the main package costs 834 MB and 3.3 GB. Sentry's SwiftPM install page doesn't mention the binaries repository yet.
It covers static linking only. From the main sentry-cocoa package you still get all seven builds whichever product you pick, SentrySPM included. For my seven apps on the static framework, the switch means a new package URL and product name. The four apps on Sentry-Dynamic and SentrySPM have no lighter option today.
StorageRadar's Dev Cleanup sizes the SwiftPM cache next to DerivedData and the other package caches. In Reports you compare two snapshots and see what grew between them: storageradar.app.
Run the first command and tell me which SDK tops your list.

Top comments (0)