Search code examples
swifttoolchainswift-package-manager

Swift Package Manager Not Installing


So if you navigate here, you'll find instructions saying that the package manager is bundled in the downloads on this page.

It says that I can check with:

swift build --help

But my only output has been:

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

I have downloaded both installation packages and installed them. I can see that the toolchains are installed here. (I also installed the previous version out of desperation).

installed toolchain

The instructions aren't very explicit and in a world of all in one IDE's, I haven't yet experienced installing a language of my own in this way. Is there something obvious I'm missing in the process?


Solution

  • Do you have the PATH environment variable setup to map to the correct Swift?

    swift --version should show

    Apple Swift version 2.2-dev (LLVM 46be9ff861, Clang 4deb154edc, Swift 778f82939c)
    Target: x86_64-apple-macosx10.9
    

    If you are running a Swift version prior to 2.2, then you need to set your path to the new toolchain installed by the Swift 2.2 snapshot. This can be done by editing your .bash_profile and adding

    export PATH=/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin:$PATH

    as the last line and then source ~/.bash_profile to update your settings.

    Edit

    On December 10, 2015 there was a new snapshot released. --version still shows 2.2-dev but shows updated (SHA-1?) hashes.

    Apple Swift version 2.2-dev (LLVM 7bae82deaa, Clang 53d04af5ce, Swift 5995ef2acd)
    Target: x86_64-apple-macosx10.9
    

    These releases are also tagged at the individual project level as a release: https://github.com/apple/swift/releases