Last active
December 13, 2023 19:01
-
-
Save jaredsinclair/185f5e44b4cee2777365aa305f572892 to your computer and use it in GitHub Desktop.
Nuke macOS Swift Package Manager manifest cache database
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Xcode does not offer a way to fully remove all cached Package manifest data from | |
# macOS. This script takes care of it for you. | |
# | |
# Important: SPM implicitly relies on the `org.swift.swiftpm` Swift package | |
# to manage a local database of resolved package manifest files. That database | |
# will happily cache your resolved manifest to character-level accuracy. To | |
# clear out the resolved package manifest, there is only one known solution: | |
# nuking and paving that database. Running the following command (standard | |
# user permissions works fine) will nuke the database: | |
rm -r ~/Library/Caches/org.swift.swiftpm/manifests | |
# Afterwards you can simply close and re-open this package and Xcode/SPM will | |
# resolve anew this Package.swift file, pulling in your updated settings. | |
# But even so.... sometimes Xcode will still infuriatingly continue to cache | |
# old crap, for example when changing an existing dependency from an SSH URL to | |
# an HTTP URL. When that happens, you have to nuke everything: | |
# 1. Quit Xcode | |
# 2. Delete derived data: | |
rm -r ~/Library/Developer/Xcode/DerivedData | |
# 3. Delete the entirety of the SPM system cache: | |
rm ~/Library/Caches/org.swift.swiftpm | |
# 4. Delete any Package.resolved files from your project | |
# 5. Open Xcode, open your project |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment