When I use the
swift package init --type executable command I get the following error message:
error: unable to invoke subcommand: /Library/Developer/CommandLineTools/usr/bin/swift-package (No such file or directory)
Using MacOS Sierra v 10.12.3 and Xcode v 8.2.1
I experienced this when I tried the tutorial too. It turned out that my Mac was using the command line tools of an earlier version of Xcode than 8.2.1. Here’s how I ended up fixing it; maybe the same solution will work for you.
Open Xcode, select Xcode > Preferences in the menu, and select the Locations tab. Check that ‘Command Line Tools’ is set to Xcode 8.2.1. Then try the
swift package command again.
could you show me how to use this to install https://github.com/remzr7/Surge into a new Xcode project?
Since Surge has Swift package Manager Support, you can add
to your dependencies.
Note that Surge doesn’t seem to have a stable release with Swift 3 support yet.
Thank you very much for this tutorial. It is promising to get to use Swift outside Xcode. On Ubunto 16.04 I am facing the following problem:
let package = Package(
$ swift build
manifest parse error(s):
/home/mjeragh/Projects/Flag/Package.swift:8:6: error: type ‘Package.Dependency’ has no member ‘Package’
PackageDescription.Package.Dependency:2:24: note: did you mean ‘package’?
public static func package(url: String, from version: PackageDescription.Version) -> PackageDescription.Package.Dependency
PackageDescription.Package.Dependency:3:24: note: did you mean ‘package’?
public static func package(url: String, _ requirement: PackageDescription.Package.Dependency.Requirement) -> PackageDescription.Package.Dependency
PackageDescription.Package.Dependency:4:24: note: did you mean ‘package’?
public static func package(url: String, _ range: Range<PackageDescription.Version>) -> PackageDescription.Package.Dependency
PackageDescription.Package.Dependency:5:24: note: did you mean ‘package’?
public static func package(url: String, _ range: ClosedRange<PackageDescription.Version>) -> PackageDescription.Package.Dependency
I figured it out.
It was the comment
Thank you for this into to Swift PM, it was helpful. Unfortunately, I can’t puzzle out how to use Swift PM in a typical GUI project in Xcode (8.3.2).
Basically, I have an existing project that is a “Cocoa Application”. It uses a framework from a GitHub repo. I’d like to use Swift PM to include that framework in my project but I can’t figure out how to organize that sort of project in Xcode using Swift PM.
I followed this tutorial using
swift-tools-version:4.0 Package Manager and had to make a few changes to the
let package = Package(
.package(url: "../Atlas", from: "1.0.0")
Also, if you choose to tag your library with anything less than x.x.x (i.e. x.x), it will not work. Package manager expects the version tag in x.x.x format.
This was my issue as well. I removed the commented line and had no further issues. Thanks!
what means “non-host platforms’” ?
in “Until the Swift Package Manager supports non-host platforms…”
This tutorial is more than six months old so questions regarding it are no longer supported for the moment. We will update it as soon as possible. Thank you! :]