Command Reference


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.2 (set by /home/kyle/.swiftenv/version)


Sets the global version of Swift to be used by writing to the ~/.swiftenv/version file. This version can be overridden by application-specific .swift-version file, or by setting the SWIFT_VERSION environment variable.

$ swiftenv global 2.2
$ swiftenv global


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 further by the SWIFT_VERSION environment variable.

Setting a local Swift version

$ swiftenv local 3.1.1

Setting the local swift version will write the version to the .swift-version file in the current working directory.

Checking the local Swift version

$ swiftenv local


Installs a version of Swift. This supports both binary releases provided by Apple, along with all open source Swift releases.

You may use --build or --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

Custom Installation

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 you run 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

$ swiftenv which lldb