使用swiftenv管理swift版本

swiftenv能够让你轻松安装和快速切换在多个版本之间切换的工具git

安装swiftenv

一、下载swifenv

git clone https://github.com/kylef/swiftenv.git ~/.swiftenv

你能够将~更改成你喜欢的目录;github

二、设置环境变量

echo 'export SWIFTENV_ROOT="$HOME/.swiftenv"' >> ~/.bash_profile
echo 'export PATH="$SWIFTENV_ROOT/bin:$PATH"' >> ~/.bash_profile
echo 'eval "$(swiftenv init -)"' >> ~/.bash_profile

若是你自定义了[1]中的目录,请将将$HOME更改成您自动的目录shell

三、重启shell

安装swift

一、使用swiftenv安装swift指定版本

swiftenv install 3.0

还能够列出全部swift版本swift

swiftenv install --list

以及全部快照bash

swiftenv install --list-snapshots

二、局部安装

在你须要安装的目录下执行工具

swiftenv local 3.0

会在当前目录下生成.swift-version文件,该文件可以覆盖全局,达到局部自定义版本;code

三、全局安装

swiftenv global 3.0
相关文章
相关标签/搜索