# Unable to set swift version

**URL:** <https://forums.swift.org/t/unable-to-set-swift-version/52909>\
**Category:** Using Swift\
**Tags:** environment\
**Created:** [October 19, 2021, 4:42pm UTC](https://forums.swift.org/t/unable-to-set-swift-version/52909 "2021-10-19T16:42:31Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Shilpee](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/shilpee/32/22631_2.png) [@Shilpee](https://forums.swift.org/u/Shilpee)\
**Post date:** [October 19, 2021, 4:42pm UTC](https://forums.swift.org/t/unable-to-set-swift-version/52909/1 "2021-10-19T16:42:32Z")

</div>

Hi,I am newbie swift learner and was trying to install swift environment. I am stuck and I would appreciate your help. I have Xcode 13.0 and swift 5.5 installed.

Here is what I did to install swift environment:  
1)git clone [GitHub - kylef/swiftenv: Swift Version Manager](https://github.com/kylef/swiftenv.git) ~/.swiftenv  
2)nano ~/.bash\_profile  
everything was empty there so I wrote as follows:  
#swiftenv

export SWIFTENV\_ROOT="$HOME/.swiftenv"

export PATH="$SWIFTENV\_ROOT/BIN:$PATH"

eval "$(swiftenv init -)"  
Then I saved it.  
3)wrote ~./bash\_profile  
4)swiftenv  
5)swift versions

got an error:  
error: unable to invoke subcommand: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift-versions (No such file or directory)  
6) for once I ignored this and wrote: cd /Library/Developer/Toolchains  
7)pwd  
8) ls-la  
9)I got  
total 0  
drwxr-xr-x 4 root wheel 128 Oct 19 20:45 .  
drwxr-xr-x 4 root admin 128 Oct 19 20:45 ..  
drwxr-xr-x 7 root wheel 224 Oct 19 20:45 swift-5.5-RELEASE.xctoolchain  
lrwxr-xr-x 1 root wheel 59 Oct 19 20:45 swift-latest.xctoolchain -\> /Library/Developer/Toolchains/swift-5.5-RELEASE.xctoolchain  
10) cd ~/Desktop/  
11)swiftenv global  
zsh displayed: swiftenv: version is not set

Now,Here at this point I felt there is something wrong.

---

<div class="post-metadata">

**Author:** ![Jon\_Shier](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/jon_shier/32/921_2.png) [@Jon\_Shier](https://forums.swift.org/u/Jon_Shier)\
**Post date:** [October 19, 2021, 5:10pm UTC](https://forums.swift.org/t/unable-to-set-swift-version/52909/2 "2021-10-19T17:10:57Z")

</div>

Modern macOS systems use zsh, not bash, as the default shell, so you'll need to modify the appropriate files for that shell (`~/.zprofile`) or switch to bash.

---

<div class="post-metadata">

**Author:** ![Shilpee](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/shilpee/32/22631_2.png) [@Shilpee](https://forums.swift.org/u/Shilpee)\
**Post date:** [October 19, 2021, 7:32pm UTC](https://forums.swift.org/t/unable-to-set-swift-version/52909/3 "2021-10-19T19:32:04Z")

</div>

Thanks for your help Sir, I tried and it's giving me error again.

 ![Screenshot 2021-10-20 at 12.57.13 AM](https://global.discourse-cdn.com/swift/original/3X/3/4/3495dcc95571a428199a60a61710072bf59040e3.jpeg)

In bash profile page I pasted this:  
echo 'export SWIFTENV\_ROOT="$HOME/.swiftenv"' \>\> ~/.zshenv  
echo 'export PATH="$SWIFTENV\_ROOT/bin:$PATH"' \>\> ~/.zshenv  
echo 'eval "$(swiftenv init -)"' \>\> ~/.zshenv

---

<div class="post-metadata">

**Author:** ![Peter-Schorn](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/peter-schorn/32/11183_2.png) [@Peter-Schorn](https://forums.swift.org/u/Peter-Schorn)\
**Post date:** [October 19, 2021, 9:02pm UTC](https://forums.swift.org/t/unable-to-set-swift-version/52909/4 "2021-10-19T21:02:54Z")

</div>

You're more likely to get help if you open an issue on the swiftenv github repository, not here.

---

<div class="post-metadata">

**Author:** ![rhx](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/rhx/32/14647_2.png) [@rhx](https://forums.swift.org/u/rhx)\
**Post date:** [October 22, 2021, 9:45pm UTC](https://forums.swift.org/t/unable-to-set-swift-version/52909/5 "2021-10-22T21:45:03Z")

</div>

> [@Shilpee](#):
>
> 5)swift versions

The command you need to use is

```swift
swiftenv versions

```

(not `swift versions`).

---

<div class="post-metadata">

**Author:** ![Shilpee](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/shilpee/32/22631_2.png) [@Shilpee](https://forums.swift.org/u/Shilpee)\
**Post date:** [October 23, 2021, 12:55pm UTC](https://forums.swift.org/t/unable-to-set-swift-version/52909/6 "2021-10-23T12:55:26Z")

</div>

![Screenshot 2021-10-23 at 6.20.49 PM](https://global.discourse-cdn.com/swift/original/3X/d/4/d45f91cbc6035223a79436b11634d8cda44bcddb.png)

swiftenv versions command did worked but still its showing version not set.

---

<div class="post-metadata">

**Author:** ![Peter-Schorn](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/peter-schorn/32/11183_2.png) [@Peter-Schorn](https://forums.swift.org/u/Peter-Schorn)\
**Post date:** [October 23, 2021, 7:42pm UTC](https://forums.swift.org/t/unable-to-set-swift-version/52909/7 "2021-10-23T19:42:35Z")

</div>

> [@Shilpee](#):
>
> but still its showing version not set.

That's because you never set the version.

`swiftenv versions` lists the available versions. To set the version to 5.3, for example, run:

```swift
swiftenv global 5.3

```

`swiftenv --help` gives you information on how to use this tool.

---

<div class="post-metadata">

**Author:** ![Shilpee](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/shilpee/32/22631_2.png) [@Shilpee](https://forums.swift.org/u/Shilpee)\
**Post date:** [October 24, 2021, 5:53am UTC](https://forums.swift.org/t/unable-to-set-swift-version/52909/8 "2021-10-24T05:53:13Z")

</div>

Ohh yeah😅 It was so obvious.  
I never set the version because I didn't know the right command for it.

Thanks btw.😊
