How to fix `warning: using (deprecated) legacy driver, Swift installation does not contain swift-driver` error in Swift

getting above error every time I use any swift command

swift --version
<unknown>:0: warning: using (deprecated) legacy driver, Swift installation does not contain swift-driver at: '/Library/Developer/CommandLineTools/usr/bin/swift-driver-new'
Apple Swift version 6.0 (swiftlang-6.0.0.3.300 clang-1600.0.20.10)
Target: arm64-apple-darwin24.0.0

Same here.
Found this.

sudo xcode-select -s /Applications/Xcode-beta.app/Contents/Developer

did it for me

2 Likes