Ilia Tikhomirov
Ilia Tikhomirov

Reputation: 599

Terminal: Swift Build command does not work

When I am using Swift Package builder in the OSX terminal, it does now work.

swift build

I get:

:0: error: no such file or directory: 'build'

REPL works and all the snapshots seem to be installed. Does anyone know the issue?

Upvotes: 4

Views: 2354

Answers (4)

manismku
manismku

Reputation: 2180

Yes. It helps. By Default command line tool will have nothing selected. Once you click a drop down will come and you can select the latest xCode. This will associate the XCode tool chain to the command line and you can use swift build, swift package init etc. You may not have to set the path also. enter image description here

Upvotes: 3

Learner
Learner

Reputation: 319

A simpler solution is to install latest Xcode and change the command line tools to point to latest XCode Version. It can be done by going to Xcode > preferences > Locations > Command line tools. Change it to Xcode (version number).

Upvotes: 0

Kirit  Vaghela
Kirit Vaghela

Reputation: 12664

/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin should be appended before $PATH in your .bashrc:

PATH=/Applications/IBM/node/bin:/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin:$PATH

Upvotes: 0

Ilia Tikhomirov
Ilia Tikhomirov

Reputation: 599

The solution is to download the development snapshot, not the release one - https://swift.org/builds/development/xcode/swift-DEVELOPMENT-SNAPSHOT-2016-02-08-a/swift-DEVELOPMENT-SNAPSHOT-2016-02-08-a-osx.pkg

Upvotes: 1

Related Questions