37

There's a "Reset Package Caches" option in the menu in Xcode, but that resets them all, which takes a while. Is it possible to just reset one package cache?

Marty
  • 5,926
  • 9
  • 53
  • 91

1 Answers1

48

To reset the cache for a single package:

  • Navigate to ~/Library/Caches/org.swift.swiftpm/repositories and deleting the folder and lock file related to the package
  • Then, in Xcode, run File-->Swift Packages-->Reset Package Caches

You can also try the solution recommended here to reset the entire cache (thanks @Bao Lei):

jarrodparkes
  • 2,378
  • 2
  • 18
  • 26
  • Both ~/Library/Caches/org.swiftpm/repositories and $BUILD_DIR/SourcePackages/repositories contains almost same git repositories. – DawnSong Apr 25 '22 at 08:48
  • 3
    This doesn't completely reset on Xcode 13.3. What solved the issue for me was right click on package in Xcode and press Update package. Somehow after all clearing it was grabbing it from some cache which I haven't figured out how can be reset – Bretsko Jun 07 '22 at 00:19
  • 3
    For Xcode 13.4 what solved this issue for me was to, in Xcode, select menu File/Packages/Reset Package Caches – Ramon Felix Aug 13 '22 at 02:57
  • 1
    In my case I also need to clear ~/Library/org.swift.swiftpm as mentioned in https://stackoverflow.com/a/72838880/1099193 – Bao Lei Sep 28 '22 at 20:24