I created a Swift executable package using swift package init --type executable. When running swift build or swift run, it tries to find xctest but fails.
swift build
# error: terminated(72): xcrun --sdk macosx --find xctest output:
# xcrun: error: unable to find utility "xctest", not a developer tool or in PATH
I have just (re-)installed a fresh Command Line Tools version. I don't want to (and don't have the disk space available) to download XCode. xcode-select --reset does not help either.
macOS 10.15.3
xcode-select version 2373
Swift version 5.1.3 (swiftlang-1100.0.282.1 clang-1100.0.33.15)
How can I build the package, without swift build looking for xctest?
Same issue here. I was trying to play with Swift and ran into this problem.
I've tried installing the swift package via brew but it also lacks xctest binary. For now, even being able to skip building/running test (to produce executable binary) would be fine.
This is about situation when you only have Command Line Tools (i.e. without Xcode) so your solution won't work as in that case /Applications/Xcode.app/Contents/Developer/usr/bin doesn't exists.