None of the referenced answers works. Something new has happened with Xcode 10.2
This happens whether or not I use Swift 4.2 or 5.
It happens immediately wit
From the Swift 5 Release Notes for Xcode 10.2:
Swift 5 Runtime Support for Command Line Tools Package
Starting with Xcode 10.2, Swift command line tools require the Swift libraries in macOS. They’re included by default starting with macOS Mojave 10.14.4. In macOS Mojave 10.14.3 and earlier, there’s an optional package to provide these runtime support libraries for Swift command line tools that you can download from More Downloads for Apple Developers. If you installed the beta version of this package, replace it with the release version. This package is only needed for Swift command line tools, not for apps with graphical user interfaces.
Note that:
SWIFT_FORCE_STATIC_LINK_STDLIB=YES
as a workaround, that is no longer necessary.I updated my macOS as was suggested, but it did not help without the following change in the Package.swift
:
- // swift-tools-version:4.2
+ // swift-tools-version:5.0
This issue happened because I update XCode to 10.2 without updating the MacOS to the latest and the sdk that I used also not updated. Apparently these steps had solved my issues :