Server Error no such module PackageDescription

On my MBP M1 running “swift run” results in an error Package.swift 2:8: error: no such module ‘PackageDescription’.
I’ve tried Rosetta “arch -x86_64 swift run” but no change.
I’m running Ventura beta, so that’s probably causing the problem. Any suggestions for getting it to work (besides regressing macOS)?

Welcome back to the forums @rlisle ! Beta software from Apple does get better as it approaches release, in the meantime, I know the pain.

Sounds like PackageDescription isn’t found, that’s the part of SPM that handles packages from your Package.swift file. What does the following command output?

xcode-select --print-path

It may be bent out of shape, or pointing to CLI tools which instead should be reverted to Xcode itself using the following command:

sudo xcode-select --switch /your/path/to/Xcode

For your reference, on my MBP M1 (Monterrey) it points to: /Applications/Xcode.app/Contents/Developer

4 Likes

Yes! That was the problem. I had installed Xcode beta, so the path had changed to /Applications/Xcode-beta/Contents/Developer. Switching the xcode-select fixed the issue. Thank you very much!

1 Like

I had the same problem after upgrading to Xcode 14.0 (with Monterey 12.6)! I fixed it with the command:
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
Thank you very much!

1 Like