vapor-docs/2.0/docs/getting-started/install-swift-3-macos.md

2.1 KiB

Install Swift 3.1: macOS

To use Swift 3.1 on macOS, you just need to have Xcode 8 installed.

Install Xcode

Install Xcode 8 from the Mac App Store.

Xcode 8

Open Xcode

After Xcode 8 has been downloaded, you must open it to finish the installation. This may take a while.

Verify Swift Installation

Double check the installation was successful by running:

eval "$(curl -sL check2.vapor.sh)"

Install TLS

Vapor 2.+ requires a TLS library like OpenSSL or LibreSSL to be installed and linked. This gives you the option to choose which security library you would like to use and helps ensure your app behaves similarly across macOS and Linux.

Installing OpenSSL is the easiest way to get up and running with Vapor.

This quick start script will guide you through the installation process.

eval "$(curl -sL openssl.vapor.sh)"

LibreSSL / Other (Advanced)

To use a different TLS library, install the library to your computer (through brew or downloading from the site). Once the library is installed, you can link it during swift build using:

swift build -Xswiftc -I/path/to/headers -Xlinker -L/path/to/libs

This method should work with any OpenSSL alternative that implements the methods required by Vapor's TLS and Crypto packages.

Homebrew LibreSSL

As a concrete example, here is how you can use LibreSSL with Vapor. First, install LibreSSL through Homebrew.

brew install libressl

Then link LibreSSL against your Vapor project when building.

swift build -Xswiftc -I/usr/local/opt/libressl/include -Xlinker -L/usr/local/opt/libressl/lib

Toolbox

You can now move on to Install Toolbox.

Swift.org

Check out Swift.org's extensive guides if you need more detailed instructions for installing Swift 3.1.