79557924

Date: 2025-04-06 07:47:39
Score: 5.5
Natty:
Report link

In fact, I still don't know the specific cause of this problem. I just started to learn Swift (starting from the configuration of the development environment).


Next, I will try my best to show my current development environment and how to solve this problem:

I used helix to write rust and python code on this Mac mini, so I installed /Library/Developer/CommandLineTools.

Recently, I want to learn Swift (CLI program), and at the same time, I think xcode is too heavy for current needs, so I didn't install xcode.

Run swift --version and swift package init according to the Build a Command-line Tool, and they are running well.

The problem occurred when running swift run, and the error message has been displayed in the problem description.

At this time, I didn't make any additional installation(because swift --version and swift package init work well).

After many useless attempts, I reinstalled CommandLineTools, and the problem was solved.


From this, it should be possible to judge that CommandLineTools has provided the basic tools of Swift:

➜ ls /Library/Developer/CommandLineTools/usr/bin | rg -i swift
aarch64-swift-linux-musl-clang++.cfg -> aarch64-swift-linux-musl-clang.cfg
aarch64-swift-linux-musl-clang.cfg
swift -> swift-frontend
swift-api-digester -> swift-frontend
swift-build -> swift-package
swift-cache-tool -> swift-frontend
swift-demangle
swift-driver
swift-experimental-sdk -> swift-package
swift-format
swift-frontend
swift-help
swift-package
swift-package-collection -> swift-package
swift-package-registry -> swift-package
swift-plugin-server
swift-run -> swift-package
swift-sdk -> swift-package
swift-stdlib-tool
swift-symbolgraph-extract -> swift-frontend
swift-synthesize-interface -> swift-frontend
swift-test -> swift-package
swiftc -> swift-frontend
x86_64-swift-linux-musl-clang++.cfg -> x86_64-swift-linux-musl-clang.cfg
x86_64-swift-linux-musl-clang.cfg
➜ ls /Library/Developer/CommandLineTools/SDKs -TL2
/Library/Developer/CommandLineTools/SDKs
├── MacOSX.sdk -> MacOSX15.4.sdk
├── MacOSX14.5.sdk
│   ├── System
│   ├── usr
│   ├── Entitlements.plist
│   ├── SDKSettings.json
│   └── SDKSettings.plist
├── MacOSX14.sdk -> MacOSX14.5.sdk
├── MacOSX15.4.sdk
│   ├── System
│   ├── usr
│   ├── Entitlements.plist
│   ├── SDKSettings.json
│   └── SDKSettings.plist
└── MacOSX15.sdk -> MacOSX15.4.sdk

Since I know nothing about Swift, please let me know if you want to know more about my development environment.

Reasons:
  • Blacklisted phrase (1): how to solve
  • RegEx Blacklisted phrase (2.5): please let me know
  • RegEx Blacklisted phrase (1): I want
  • RegEx Blacklisted phrase (1): I know nothing about Swift, please
  • Long answer (-1):
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: 3moredays