You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
swiftly is a CLI tool for installing, managing, and switching between [Swift](https://www.swift.org/) toolchains, written in Swift. swiftly itself is designed to be extremely easy to install and get running, and its command interface is intended to be flexible while also being simple to use. The overall experience is inspired by and meant to feel reminiscent of the Rust toolchain manager [rustup](https://rustup.rs/).
3
+
swiftly is a CLI tool for installing, managing, and switching between [Swift](https://www.swift.org/) toolchains, written in Swift. swiftly itself is designed to be extremely easy to install and get running, and its command interface is intended to be flexible while also being simple to use. You can use it with Linux and macOS.
4
4
5
-
Ongoing maintenance and stewardship of this project is led by the [SSWG](https://www.swift.org/sswg/).
5
+
### Installation and Basic Usage
6
6
7
-
###Installation
7
+
⚠️ Installation has changed from the 0.3.0 release. See [Upgrade from previous](#upgrade-from-previous) below for notes on upgrading from older releases.
8
8
9
-
Install swiftly using a script (hosted from this repository) using the command:
9
+
Install swiftly by going to the [Swift Install Page](https://swift.org/install) of swift.org and following the instructions there.
In the future, download the swiftly package from [swift.org](https://swift.org/download) and it can install itself with init:
11
+
Once swiftly is installed it will automatically install the latest released toolchain. You can use the familiar toolchain commands right away:
16
12
17
13
```
18
-
swiftly init
19
-
```
20
-
21
-
### Basic usage
22
-
23
-
```
24
-
$ swiftly install latest
25
-
26
-
Fetching the latest stable Swift release...
27
-
Installing Swift 5.8.1
28
-
Downloaded 488.5 MiB of 488.5 MiB
29
-
Extracting toolchain...
30
-
Swift 5.8.1 installed successfully!
31
-
32
-
$ swift --version
33
-
34
-
Swift version 5.8.1 (swift-5.8.1-RELEASE)
14
+
swift --version
15
+
--
16
+
Swift version 6.0.3 (swift-6.0.3-RELEASE)
35
17
Target: x86_64-unknown-linux-gnu
36
18
```
37
19
38
-
## Features
39
-
40
-
- Installing multiple toolchains, including both stable releases and snapshots
41
-
- Switching which installed toolchain is active (i.e. which one is discovered via `$PATH`)
42
-
- Updating installed toolchains to the latest available versions of those toolchains
43
-
- Uninstalling installed toolchains
44
-
- Listing the toolchains that are available to install (not yet implemented)
45
-
46
-
## Platform support
47
-
48
-
- Linux-based platforms listed on https://swift.org/download
49
-
50
-
Right now, swiftly is in early stages of development and is supported on Linux and macOS. For more detailed information about swiftly's intended features and implementation, check out the [design document](DESIGN.md).
51
-
52
-
## Command interface overview
53
-
54
-
### Installing a toolchain
55
-
56
-
#### Install the latest version of Swift
57
-
58
-
```
59
-
$ swiftly install latest
60
-
```
61
-
62
-
#### Installing a specific release version of Swift
63
-
64
-
A specific version of Swift can be provided to the `install` command.
65
-
66
-
```
67
-
$ swiftly install 5.6.1
68
-
```
69
-
70
-
If a patch version isn't specified, swiftly will look up and install the latest patch version that matches the minor version provided:
71
-
72
-
```
73
-
$ swiftly install 5.6
74
-
```
75
-
76
-
#### Installing main development snapshots (trunk)
77
-
78
-
```
79
-
$ swiftly install main-snapshot-2022-01-28
80
-
```
81
-
82
-
If the date isn't specified, swiftly will look up and install the latest available snapshot:
83
-
84
-
```
85
-
$ swiftly install main-snapshot
86
-
```
87
-
88
-
#### Installing Swift version development snapshots
89
-
90
-
```
91
-
$ swiftly install 5.7-snapshot-2022-08-30
92
-
```
93
-
94
-
If the date isn't specified, swiftly will look up and install the latest snapshot associated with the provided development branch:
95
-
96
-
```
97
-
$ swiftly install 5.7-snapshot
98
-
```
99
-
100
-
### Uninstalling a toolchain
101
-
102
-
#### Uninstall a release toolchain
103
-
104
-
```
105
-
$ swiftly uninstall 5.6.3
106
-
```
107
-
108
-
To uninstall all toolchains associated with a given minor release, leave off the patch version:
109
-
110
-
```
111
-
$ swiftly uninstall 5.6
112
-
```
113
-
114
-
#### Uninstall a snapshot toolchain
115
-
116
-
```
117
-
$ swiftly uninstall main-snapshot-2022-08-30
118
-
$ swiftly uninstall 5.7-snapshot-2022-08-30
119
-
```
120
-
121
-
To uninstall all snapshots associated with a given branch (either main or a release branch), omit the date:
122
-
123
-
```
124
-
$ swiftly uninstall main-snapshot
125
-
$ swiftly uninstall 5.7-snapshot
126
-
```
127
-
128
-
### Listing installed toolchains
129
-
130
-
The `list` command prints all the toolchains installed by swiftly:
131
-
132
-
```
133
-
$ swiftly list
134
-
```
135
-
136
-
### Selecting a toolchain for use
137
-
138
-
“Using” a toolchain sets it as the active toolchain, meaning it will be the one found via $PATH and invoked via `swift` commands executed in the shell. The toolchain must be installed before you can use it.
139
-
140
-
You can provide the same version selectors as you used with `swiftly install` to use a toolchain, including exact releacs versions "major.minor.patch", and snapshots.
141
-
142
-
```
143
-
$ swiftly use latest
144
-
$ swiftly use 5.3.1
145
-
$ swiftly use 5.3
146
-
$ swiftly use 5.3-snapshot
147
-
$ swiftly use 5.3-snapshot-2022-08-16
148
-
$ swiftly use main-snapshot
149
-
$ swiftly use main-snapshot-2024-06-18
150
-
```
151
-
152
-
After you use a toolchain your commands at the shell will run with that toolchain:
153
-
154
-
```
155
-
$ swiftly use x.y.z
156
-
$ swift build # Build my package with toolchain version x.y.z
157
-
$ clang -c foo.c -o foo.o # Compile this C file using the clang compiler in toolchain version x.y.z
158
-
$ lldb # Open the debugger from toolchain version x.y.z
159
-
```
160
-
161
-
If you want to run just one command with a particular toolchain without having to switch back to the one you used previously you can use the `swiftly run` command with the version. This command builds your current package with the latest snapshot toolchain of the current release:
162
-
163
-
```
164
-
$ swiftly run swift build +main-snapshot
165
-
```
166
-
167
-
The parameter with the "+" indicates that this is the version selector of the toolchain to use and supports the full range of selectors shown above and with the `swiftly install` command. The toolchain must be installed to run a command with that toolchain.
168
-
169
-
### Updating a toolchain
170
-
171
-
Update replaces a given toolchain with a later version of that toolchain. For a stable release, this means updating to a later patch, minor, or major version. For snapshots, this means updating to the most recently available snapshot.
172
-
173
-
If no version is provided, update will update the currently selected toolchain to its latest patch release if a release toolchain or the latest available snapshot if a snapshot. The newly installed version will be selected.
174
-
175
-
```
176
-
$ swiftly update
177
-
```
178
-
179
-
To update the latest installed release version to the latest available release version, the “latest” version can be provided. Note that this may update the toolchain to the next minor or even major version.
180
-
181
-
```
182
-
swiftly update latest
183
-
```
184
-
185
-
If only a major version is specified, the latest installed toolchain with that major version will be updated to the latest available release of that major version:
186
-
187
-
```
188
-
swiftly update 5
189
-
```
190
-
191
-
If the major and minor version are specified, the latest installed toolchain associated with that major/minor version will be updated to the latest available patch release for that major/minor version.
192
-
193
-
```
194
-
swiftly update 5.3
195
-
```
196
-
197
-
You can also specify a full version to update that toolchain to the latest patch available for that major/minor version:
198
-
199
-
```
200
-
swiftly update 5.3.1
201
-
```
202
-
203
-
Similarly, to update the latest snapshot associated with a specific version, the “a.b-snapshot” version can be supplied:
204
-
205
20
```
206
-
swiftly update 5.3-snapshot
21
+
lldb
22
+
--
23
+
(lldb): _
207
24
```
208
25
209
-
You can also update the latest installed main snapshot to the latest available one by just providing `main-snapshot`:
26
+
Install another toolchain, such as the latest nightly snapshot of the main branch. Use it so that when you run a toolchain command it uses that one.
210
27
211
28
```
212
-
swiftly update main-snapshot
29
+
swiftly install main-snapshot
30
+
swiftly use main-snapshot
31
+
swift --version
32
+
--
33
+
Apple Swift version 6.2-dev (LLVM 059105ceb0cb60e, Swift 714c862d3791544)
34
+
Target: arm64-apple-macosx15.0
35
+
Build config: +assertions
213
36
```
214
37
215
-
A specific snapshot toolchain can be updated to the newest available snapshot for that branch by including the date:
38
+
For more detailed usage guides there is [documentation](https://swiftpackageindex.com/swiftlang/swiftly/main/documentation/swiftlydocs).
216
39
217
-
```
218
-
swiftly update 5.9-snapshot-2023-09-20
219
-
```
220
-
221
-
### Listing toolchains available to install
222
-
223
-
The `list-available` command can be used to list the latest toolchains that Apple has made available to install.
224
-
225
-
Note that this command isn't implemented yet, but it will be included in a future release.
226
-
227
-
```
228
-
swiftly list-available
229
-
```
40
+
## Features
230
41
231
-
A selector can optionally be provided to narrow down the results:
42
+
-[Installing multiple toolchains](https://swiftpackageindex.com/swiftlang/swiftly/main/documentation/swiftlydocs/install-toolchains), including both stable releases and snapshots
43
+
-[Switching which installed toolchain is active](https://swiftpackageindex.com/swiftlang/swiftly/main/documentation/swiftlydocs/use-toolchains) (i.e. which one is discovered via `$PATH`)
44
+
-[Updating installed toolchains](https://swiftpackageindex.com/swiftlang/swiftly/main/documentation/swiftlydocs/update-toolchain) to the latest available versions of those toolchains
- Listing the toolchains that are available to install with the [list-available](https://swiftpackageindex.com/swiftlang/swiftly/main/documentation/swiftlydocs/swiftly-cli-reference#list-available) subcommand
47
+
- Sharing the preferred toolchain as a project setting with a [.swift-version](https://swiftpackageindex.com/swiftlang/swiftly/main/documentation/swiftlydocs/use-toolchains#Sharing-recommended-toolchain-versions) file
48
+
- Running a single command on a particular toolchain with the [run](https://swiftpackageindex.com/swiftlang/swiftly/main/documentation/swiftlydocs/swiftly-cli-reference#run) subcommand
232
49
233
-
```
234
-
$ swiftly list-available 5.6
235
-
$ swiftly list-available main-snapshot
236
-
$ swiftly list-available 5.7-snapshot
237
-
```
50
+
## Platform support
238
51
239
-
### Updating swiftly
52
+
swiftly is supported on Linux and macOS. For more detailed information about swiftly's intended features and implementation, check out the [design document](DESIGN.md).
240
53
241
-
This command checks to see if there are new versions of `swiftly` itself and upgrades to them if so.
54
+
## Updating swiftly
242
55
243
-
Note that this command isn't implemented yet, but it will be included in a future release.
56
+
This command checks to see if there are new versions of swiftly itself and upgrades to them if possible.
244
57
245
58
`swiftly self-update`
246
59
247
-
### Specifying a snapshot toolchain
60
+
##Contributing
248
61
249
-
The canonical name for a snapshot toolchain in swiftly's command interface is the following:
62
+
Welcome to the Swift community!
250
63
251
-
```
252
-
<branch>-snapshot-YYYY-MM-DD
253
-
```
64
+
Contributions to Swiftly are welcomed and encouraged! Please see the [Contributing to Swift guide](swift.org/contributing) and check out the [structure of the community](https://www.swift.org/community/#community-structure).
254
65
255
-
However, swiftly also accepts the snapshot toolchain filenames from the downloads provided by swift.org. For example:
66
+
To be a truly great community, Swift needs to welcome developers from all walks of life, with different backgrounds, and with a wide range of experience. A diverse and friendly community will have more great ideas, more unique perspectives, and produce more great code. We will work diligently to make the Swift community welcoming to everyone.
256
67
257
-
```
258
-
swift-DEVELOPMENT-SNAPSHOT-2022-09-10-a
259
-
swift-5.7-DEVELOPMENT-SNAPSHOT-2022-08-30-a
260
-
```
68
+
To give clarity of what is expected of our members, Swift has adopted the code of conduct defined by the Contributor Covenant. This document is used across many open source communities, and we think it articulates our values well. For more, see the [Code of Conduct](https://www.swift.org/code-of-conduct/).
261
69
262
-
The canonical name format was chosen to reduce the keystrokes needed to refer to a snapshot toolchain, but the longer form is also useful when copy/pasting a toolchain name provided from somewhere else.
70
+
## Upgrade from previous
263
71
264
-
## Contributing
265
-
Welcome to the Swift community!
72
+
Swiftly prior to verion 1.0.0 had a different installation and delivery mechanism. Upgrading to the newest version of swiftly involves two steps:
266
73
267
-
Contributions to Swiftly are welcomed and encouraged! Please see the [Contributing to Swift guide](swift.org/contributing) and check out the [structure of the community](https://www.swift.org/community/#community-structure).
74
+
1. Uninstall older swiftly
75
+
2. Install the newest swiftly using the instructions above
268
76
269
-
To be a truly great community, Swift needs to welcome developers from all walks of life, with different backgrounds, and with a wide range of experience. A diverse and friendly community will have more great ideas, more unique perspectives, and produce more great code. We will work diligently to make the Swift community welcoming to everyone.
77
+
To uninstall the old swiftly, first locate the swiftly home directory, which is often in `~/.local/share/swiftly` and remove it. Then check your shell profile files (`~/.profile`, `~/.zprofile`, `~/.bash_profile`, or `~/.config/fish/conf.d`) and remove any entries that attempt to source the `env.sh` or `env.fish` file in the swiftly home directory. Finally, remove the symbolic links that swiftly placed in your `~/.local/bin` to toolchain binaries (e.g. swift, clang, lldb, etc.). These will likely be symbolic links to toolchain directories in the swiftly home directory. Remove them so that there aren't any orphaned path entries.
270
78
271
-
To give clarity of what is expected of our members, Swift has adopted the code of conduct defined by the Contributor Covenant. This document is used across many open source communities, and we think it articulates our values well. For more, see the [Code of Conduct](https://www.swift.org/code-of-conduct/).
79
+
Restart your shell and/or terminal to get a fresh environment. You should be ready to installing the new swiftly.
272
80
273
81
## FAQ
274
82
@@ -280,13 +88,13 @@ Swift.org currently provides experimental [`.rpm` and `.deb`](https://forums.swi
280
88
281
89
swiftenv is an existing Swift version manager which already has much of the functionality that swiftly will eventually have. It's an awesome tool, and if it's part of your workflow then we encourage you to keep using it! That said, swiftly is/will be different a few ways:
282
90
283
-
- swiftly is being built as a community driven effort led by the Swift server workgroup, and through this collaboration, swiftly will eventually become an official installation tool for Swift toolchains. As first step towards that, swiftly will help inform the creation of API endpoints maintained by the Swift project that it will use to retrieve information about what toolchains are available to install and to verify their expected signatures. swiftenv currently uses a third party API layer for this. Using an official API reduces the avenues for security vulnerabilities and also reduces the risk of downtime affecting Swift installations.
91
+
- swiftly is being built as a community driven effort, and through this collaboration, swiftly is an official installation tool for Swift toolchains. swiftly has helped to inform the creation of API endpoints maintained by the Swift project that it uses to retrieve information about what toolchains are available to install and to verify their expected signatures. swiftenv currently uses a third party API layer for this. Using an official API reduces the avenues for security vulnerabilities and also reduces the risk of downtime affecting Swift installations.
284
92
285
93
- swiftly will be written in Swift, which we think is important for maintainability and encouraging community contributions.
286
94
287
95
- swiftly has first-class support for installing and managing snapshot toolchains.
288
96
289
97
- swiftly has built in support for updating toolchains.
290
98
291
-
- swiftly is optimized for ease of installation--it can be done with a bash one-liner similar to Homebrew and rustup. In addition, swiftly won't require any system dependencies to be installed on the user's system. While swiftenv is also relatively easy to install, it does involve cloning a git repository or using Homebrew, and it requires a few system dependencies (e.g. bash, curl, tar).
99
+
- swiftly is optimized for ease of installation. In addition, swiftly doesn't require any system dependencies to be installed on the user's system. While swiftenv is also relatively easy to install, it does involve cloning a git repository or using Homebrew, and it requires a few system dependencies (e.g. bash, curl, tar).
0 commit comments