Skip to content

Package.swift is needed to purge cache #9235

@j-hui

Description

@j-hui

Description

The swift package purge-cache requires Package.swift, but it's not clear to me why this is needed.

Expected behavior

It just purges the cache without requiring Package.swift in the local directory. This is a action that affects the global cache, so I expect it to work globally, not only in the context of a Swift package.

Actual behavior

$ swift package purge-cache
error: Could not find Package.swift in this directory or any of its parent directories.

In fact, it works if I just put down a dummy Package.swift file:

$ touch Package.swift
$ swift package purge-cache && echo success
echo success

Steps to reproduce

No response

Swift Package Manager version/commit hash

Swift Package Manager - Swift 6.2.0-dev (from main-snapshot-2025-06-22)

Swift & OS version (output of swift --version && uname -a)

Apple Swift version 6.2-dev (LLVM 4197ac1672a278c, Swift acbdfef4f4d71b1)
Target: arm64-apple-macosx26.0
Build config: +assertions
Darwin metagross 25.0.0 Darwin Kernel Version 25.0.0: Mon Aug 25 21:48:38 PDT 2025; root:xnu_development-12377.1.9~2/DEVELOPMENT_ARM64_T6020 arm64```

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions