Everywhere All articles Download Buy — $19

Where apps hide your files

Finding SwiftPM's cache and checkouts

Updated 2026-10-28 · 5 min read

Swift Package Manager keeps a shared cache in your Library folder and a separate .build folder inside every project. This guide shows where each one is, which swift commands clear them, and what to leave alone.

The location

Swift Package Manager keeps its shared cache here:

~/Library/Caches/org.swift.swiftpm

On the Mac used for this guide that folder held manifests/ (a database of parsed Package.swift files) and a package-collection.db file, 168 KB in total. Newer folders for downloaded source, such as repositories, appear there once packages have been fetched from the command line. Two other places matter just as much, because they are where the big files usually are:

LocationWhat it holds
~/Library/Caches/org.swift.swiftpmThe shared cache used by swift commands: manifest cache and cached clones of dependencies.
<project>/.buildPer-project build output, with checkouts, repositories, artifacts and workspace-state.json for dependencies.
~/Library/Developer/Xcode/DerivedData/<project>-<id>/SourcePackagesThe same idea for Xcode projects, which keep their own checkouts per project.

Open the shared cache from Terminal:

open ~/Library/Caches/org.swift.swiftpm

Or choose Go > Go to Folder (⇧⌘G) in Finder and paste the path.

Related folders SwiftPM uses

SwiftPM also has a configuration folder and a security folder, both outside the cache:

~/Library/org.swift.swiftpm/configuration
~/Library/org.swift.swiftpm/security

On the Mac used for this guide configuration held a collections.json and security held a fingerprints folder (records of package signing and trust). Do not delete these as part of a cache clean. They are settings, not caches.

You may also see a ~/.swiftpm folder with cache, configuration and security entries. Here they are symbolic links to the Library folders above, so there is one real copy of each.

Changing where SwiftPM keeps them

The tool's own help lists options to relocate each folder: --cache-path, --config-path, --security-path and --scratch-path (the per-project build folder, .build by default). For example:

swift build --scratch-path /Volumes/Fast/build-myapp

For a Mac running low on space, putting a project's scratch path on an external drive is the usual use. Pass the same options every time, since they apply per command.

What is inside a project's .build folder

A package built with swift build keeps these under .build (checked on a project on the Mac used for this guide):

ItemMeaning
checkouts/Source of each dependency, checked out at the version Package.resolved pins.
repositories/Git clones that the checkouts are made from.
artifacts/Binary dependencies, such as pre-built frameworks.
workspace-state.jsonSwiftPM's record of which dependencies are in use. A small file, but do not edit it.
debug/, x86_64-apple-macosx/ (or arm64-apple-macosx/)Compiled products. The architecture folder name follows the machine that built it, and debug is a link into it.
build.db, manifest.pif, *.yamlBuild-system bookkeeping that is regenerated.

Your own source and Package.resolved live beside .build, not inside it, so removing .build never touches them. Commit Package.resolved if you want teammates to get the same dependency versions, and keep .build out of git.

What takes the space

Per-project .build folders are normally the largest. Each holds compiled output for debug and release, per architecture, as well as checked-out dependencies. Check yours, without changing anything:

du -sh .build

Run it from a project folder, or point at a path. To find every .build folder under a directory, list them first:

find ~/Documents -maxdepth 4 -type d -name .build

Clearing the cache safely

SwiftPM has built-in commands, which are safer than deleting folders by hand. Run them from a package folder:

CommandWhat it does
swift package cleanDeletes build artifacts of this package.
swift package purge-cachePurges the global repository cache, the shared cache above.
swift package resetResets the complete cache and build directory for this package, according to its own help text.
swift package resolveFetches dependencies again, in line with Package.resolved.

Those are the commands listed by swift package --help on the Mac used for this guide (Swift 6.2.4). swift package reset goes further than clean, so use clean first if you only want build output gone. Everything in the cache is rebuildable, so the only cost of clearing it is a re-download and slower first resolve for each package.

If you prefer Finder, quit Xcode and any swift build first, then move the folder to the Trash. Do not delete ~/Library/org.swift.swiftpm.

Xcode's separate package state

Xcode keeps each project's resolved packages under its DerivedData folder. If a package looks stale or fails to resolve in Xcode, choose File > Packages > Reset Package Caches, then File > Packages > Resolve Package Versions. The same submenu has Update to Latest Package Versions (names checked in Xcode 26.3). Removing a project's DerivedData folder also clears its SourcePackages. That folder sits at ~/Library/Developer/Xcode/DerivedData unless you changed it in Xcode's settings, and the separate guide to DerivedData covers it.

Versions and native builds

What is inside ~/Library/Caches/org.swift.swiftpm depends on what you have fetched and with which Swift release, which is why one Mac shows repositories there and another only manifests. Match on the folder name, not on what is inside. On an Apple silicon Mac, if your shell runs under Rosetta, swift build may produce x86_64 output unless you start it with arch -arm64 (the project checked here has an x86_64-apple-macosx folder for that reason), so look for both architecture folders when cleaning.

Why search misses these files

The cache is in ~/Library/Caches, which Spotlight and Finder searches leave out, and .build is a hidden folder. Terminal tools find them directly.

Finding them again later

Typing org.swift.swiftpm into Everywhere lists both folders of that name, the cache and the one holding configuration and security data, in one search, and typing SourcePackages lists each Xcode project's package folder, so you can see how many exist. workspace-state.json finds the dependency state file in every .build (projects in Documents or Desktop appear once it has Full Disk Access). It searches names only, and it does not report folder sizes, so use du -sh for that.

Common questions

Where is the Swift Package Manager cache on a Mac?

In ~/Library/Caches/org.swift.swiftpm. Per-project build output and checkouts are in .build inside each package, and Xcode projects keep theirs under DerivedData.

How do I clear the SwiftPM cache?

Run swift package purge-cache to purge the global cache, or swift package reset to clean one package's local state. Both are listed by swift package --help.

Is it safe to delete ~/Library/Caches/org.swift.swiftpm?

Yes, it is a cache and SwiftPM rebuilds it, at the cost of re-downloading packages. Do not delete ~/Library/org.swift.swiftpm, which holds configuration and security data.

Why is my .build folder so big?

It holds compiled output for each configuration and architecture plus dependency checkouts. swift package clean removes build artifacts, and swift package reset removes more.

Find any file before you finish typing

Everywhere keeps track of every file on your Mac — including the folders Spotlight hides and drives you have unplugged. Free for a day, then $19 once.

Version 2.20.3 · macOS 13+ · 4.7 MB · notarised

Related

© 2026 Caretopia Network Private Limited Everywhere for Mac Buy a licence Articles Privacy Support