Displays the current active Swift version and why it was chosen.
$ swiftenv version 2.2 (set by /home/kyle/.swiftenv/version)
Lists all installed Swift versions, showing an asterisk next to the currently active version.
$ swiftenv versions 2.1.1 * 2.2 (set by /home/kyle/.swiftenv/version) DEVELOPMENT-SNAPSHOT-2016-03-01-a
Sets the global version of Swift to be used by writing to the
~/.swiftenv/version file. This version can be overridden by
.swift-version file, or by setting the
$ swiftenv global 2.2 $ swiftenv global 2.2
Sets the local application-specific Swift version by writing the version to a
.swift-version file in the current directory. This version overrides the
global version and can also be overridden by th
$ swiftenv local 2.2 $ swiftenv local 2.2
Installs a version of Swift. This supports both binary releases provided by Apple, along with all open source Swift releases.
You may use
--no-build to force a building from source, or
installing from a binary release. Otherwise swiftenv will prefer installing
from a binary release if available.
Please see Building Swift from source for more information.
$ swiftenv install 2.2
You may also install from a user supplied URLs to a Swift Binary package URL from Swift Snapshots as a parameter
Installing Swift from a URL¶
You may pass a URL of a binary Swift release directly to swiftenv install.
$ swiftenv install https://swift.org/builds/development/xcode/swift-DEVELOPMENT-SNAPSHOT-2016-03-01-a/swift-DEVELOPMENT-SNAPSHOT-2016-03-01-a-osx.pkg Downloading https://swift.org/builds/development/xcode/swift-DEVELOPMENT-SNAPSHOT-2016-03-01-a/swift-DEVELOPMENT-SNAPSHOT-2016-03-01-a-osx.pkg
You may also manually install Swift and make it accessible to swiftenv. Custom
Swift installations can either be placed in a directory using the correct
version number at
~/.swiftenv/versions/VERSION, or can be symbolic
linked into the version directory.
It is expected that all dependencies are already installed for running Swift, please consult the Swift website for more information.
NOTE: After manually installing a version of Swift, it’s recommended that
swiftenv rehash to update the shims.
Verifying Linux Binary Packages¶
When downloading a pre-built binary package, swiftenv can also download the corresponding signature and verify it with gpg. This option assumes gpg is installed on the system, and the Swift public keys already exist on the public gpg keyring. If verification fails, the version will not be installed. Signatures are currently only checked in this way for Linux builds.
$ swiftenv install 2.2 --verify
Uninstalls a specific Swift version.
$ swiftenv uninstall 2.2
Installs shims for the Swift binaries. This command should be ran after you manually install new versions of Swift.
$ swiftenv rehash
Displays the full path to the executable that would be invoked for the selected version for the given command.
$ swiftenv which swift /home/kyle/.swiftenv/versions/2.2/usr/bin/swift $ swiftenv which lldb /home/kyle/.swiftenv/versions/2.2/usr/bin/lldb