How to get Swift 2.3 in command line?


(Zhao Xin) #1

I try to change command line tool from Xcode 8.0(8S193k) to Xcode
7.3.1(7D1014), who lead me to swift 3.0 or swift 2.2. I need Swift 2.3 to
build Realm Cocoa from its source.

Any idea?

Zhaoxin


(Zhao Xin) #2

There are two toolchains under Xcode-beta.app/Contents/
Developer/Toolchains/.

Swift_2.3.xctoolchain/
XcodeDefault.xctoolchain/

So in a terminal. input

export PATH=/Applications/Xcode-beta.app/Contents/Developer/
Toolchains/Swift_2.3.xctoolchain/usr/bin:"${PATH}"

After I did that, when I input swift, it would be 2.3, but when I type
xcrun swift, it was still 3.0 or 2.2.

Any idea?​

Zhaoxin​

···

On Thu, Aug 11, 2016 at 12:44 PM, Zhao Xin <owenzx@gmail.com> wrote:

I try to change command line tool from Xcode 8.0(8S193k) to Xcode
7.3.1(7D1014), who lead me to swift 3.0 or swift 2.2. I need Swift 2.3 to
build Realm Cocoa from its source.

Any idea?

Zhaoxin


(Keith Smiley) #3

You can accomplish this with the `--toolchain` `xcrun` argument. It took a few
tries but it seems as though this command works:

xcrun --toolchain "com.apple.dt.toolchain.Swift_2_3" swiftc -v

I got this identifier from:

/Applications/Xcode-beta.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/ToolchainInfo.plist

···

--
Keith Smiley

On 08/11, Zhao Xin via swift-users wrote:

There are two toolchains under Xcode-beta.app/Contents/
Developer/Toolchains/.

> Swift_2.3.xctoolchain/
> XcodeDefault.xctoolchain/

So in a terminal. input

> export PATH=/Applications/Xcode-beta.app/Contents/Developer/
> Toolchains/Swift_2.3.xctoolchain/usr/bin:"${PATH}"

After I did that, when I input swift, it would be 2.3, but when I type
xcrun swift, it was still 3.0 or 2.2.

Any idea?​

Zhaoxin​

On Thu, Aug 11, 2016 at 12:44 PM, Zhao Xin <owenzx@gmail.com> wrote:

> I try to change command line tool from Xcode 8.0(8S193k) to Xcode
> 7.3.1(7D1014), who lead me to swift 3.0 or swift 2.2. I need Swift 2.3 to
> build Realm Cocoa from its source.
>
> Any idea?
>
> Zhaoxin
>

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


(Zhao Xin) #4

Thank you Keith. You helped me a lot. I finally got it work.

As realm use "xcrun swift" to get swift version. I did that by 'export
TOOLCHAINS=com.apple.dt.toolchain.Swift_2_3'.

I also think the document in https://swift.org/download/#using-downloads should
change

$ export

PATH=/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin:"${PATH}"

to export TOOLCHAINS as well.

Zhaoxin

···

On Thu, Aug 11, 2016 at 2:56 PM, Keith Smiley <k@keith.so> wrote:

You can accomplish this with the `--toolchain` `xcrun` argument. It took a
few
tries but it seems as though this command works:

xcrun --toolchain "com.apple.dt.toolchain.Swift_2_3" swiftc -v

I got this identifier from:

/Applications/Xcode-beta.app/Contents/Developer/Toolchains/
Swift_2.3.xctoolchain/ToolchainInfo.plist

--
Keith Smiley

On 08/11, Zhao Xin via swift-users wrote:
> There are two toolchains under Xcode-beta.app/Contents/
> Developer/Toolchains/.
>
> > Swift_2.3.xctoolchain/
> > XcodeDefault.xctoolchain/
>
>
> So in a terminal. input
>
> > export PATH=/Applications/Xcode-beta.app/Contents/Developer/
> > Toolchains/Swift_2.3.xctoolchain/usr/bin:"${PATH}"
>
>
> After I did that, when I input swift, it would be 2.3, but when I type
> xcrun swift, it was still 3.0 or 2.2.
>
> Any idea?​
>
> Zhaoxin​
> ​
>
>
> On Thu, Aug 11, 2016 at 12:44 PM, Zhao Xin <owenzx@gmail.com> wrote:
>
> > I try to change command line tool from Xcode 8.0(8S193k) to Xcode
> > 7.3.1(7D1014), who lead me to swift 3.0 or swift 2.2. I need Swift 2.3
to
> > build Realm Cocoa from its source.
> >
> > Any idea?
> >
> > Zhaoxin
> >

> _______________________________________________
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users


(Sikhapol Saijit) #5

If you already have two versions of Xcode installed in the /Application then I think using xcode-select tool would be easier.

type sudo xcode-select -s /Application/Xcode.app will get you Swift 2.3 and all the environment of Xcode 7

sudo xcode-select -s /Application/Xcode-Beta.app will quickly switch everything to Xcode 8

Sam

···

On Aug 11, 2016, at 2:58 PM, Zhao Xin via swift-users <swift-users@swift.org> wrote:

Thank you Keith. You helped me a lot. I finally got it work.

As realm use "xcrun swift" to get swift version. I did that by 'export TOOLCHAINS=com.apple.dt.toolchain.Swift_2_3'.

I also think the document in https://swift.org/download/#using-downloads should change

$ export PATH=/Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin:"${PATH}"

to export TOOLCHAINS as well.

Zhaoxin

On Thu, Aug 11, 2016 at 2:56 PM, Keith Smiley <k@keith.so> wrote:
You can accomplish this with the `--toolchain` `xcrun` argument. It took a few
tries but it seems as though this command works:

xcrun --toolchain "com.apple.dt.toolchain.Swift_2_3" swiftc -v

I got this identifier from:

/Applications/Xcode-beta.app/Contents/Developer/Toolchains/Swift_2.3.xctoolchain/ToolchainInfo.plist

--
Keith Smiley

On 08/11, Zhao Xin via swift-users wrote:
> There are two toolchains under Xcode-beta.app/Contents/
> Developer/Toolchains/.
>
> > Swift_2.3.xctoolchain/
> > XcodeDefault.xctoolchain/
>
>
> So in a terminal. input
>
> > export PATH=/Applications/Xcode-beta.app/Contents/Developer/
> > Toolchains/Swift_2.3.xctoolchain/usr/bin:"${PATH}"
>
>
> After I did that, when I input swift, it would be 2.3, but when I type
> xcrun swift, it was still 3.0 or 2.2.
>
> Any idea?​
>
> Zhaoxin​
> ​
>
>
> On Thu, Aug 11, 2016 at 12:44 PM, Zhao Xin <owenzx@gmail.com> wrote:
>
> > I try to change command line tool from Xcode 8.0(8S193k) to Xcode
> > 7.3.1(7D1014), who lead me to swift 3.0 or swift 2.2. I need Swift 2.3 to
> > build Realm Cocoa from its source.
> >
> > Any idea?
> >
> > Zhaoxin
> >

> _______________________________________________
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users


(Zhao Xin) #6

Thanks, Sam. However, as in Xcode-Beta.app, there are two version of Swift,
3.0 and 2.3, and 3.0 is chosen if I do your method.

Zhaoxin

···

On Thu, Aug 18, 2016 at 10:11 AM, Sikhapol Saijit <sikhapol@gmail.com> wrote:

If you already have two versions of Xcode installed in the /Application
then I think using *xcode-select* tool would be easier.

type *sudo xcode-select -s /Application/Xcode.app* will get you Swift 2.3
and all the environment of Xcode 7

*sudo xcode-select -s /Application/Xcode-Beta.app *will quickly switch
everything to Xcode 8

Sam

On Aug 11, 2016, at 2:58 PM, Zhao Xin via swift-users < > swift-users@swift.org> wrote:

Thank you Keith. You helped me a lot. I finally got it work.

As realm use "xcrun swift" to get swift version. I did that by 'export
TOOLCHAINS=com.apple.dt.toolchain.Swift_2_3'.

I also think the document in https://swift.org/download/#using-downloads should
change

$ export PATH=/Library/Developer/Toolchains/swift-latest.

xctoolchain/usr/bin:"${PATH}"

to export TOOLCHAINS as well.

Zhaoxin

On Thu, Aug 11, 2016 at 2:56 PM, Keith Smiley <k@keith.so> wrote:

You can accomplish this with the `--toolchain` `xcrun` argument. It took
a few
tries but it seems as though this command works:

xcrun --toolchain "com.apple.dt.toolchain.Swift_2_3" swiftc -v

I got this identifier from:

/Applications/Xcode-beta.app/Contents/Developer/Toolchains/S
wift_2.3.xctoolchain/ToolchainInfo.plist

--
Keith Smiley

On 08/11, Zhao Xin via swift-users wrote:
> There are two toolchains under Xcode-beta.app/Contents/
> Developer/Toolchains/.
>
> > Swift_2.3.xctoolchain/
> > XcodeDefault.xctoolchain/
>
>
> So in a terminal. input
>
> > export PATH=/Applications/Xcode-beta.app/Contents/Developer/
> > Toolchains/Swift_2.3.xctoolchain/usr/bin:"${PATH}"
>
>
> After I did that, when I input swift, it would be 2.3, but when I type
> xcrun swift, it was still 3.0 or 2.2.
>
> Any idea?​
>
> Zhaoxin​
> ​
>
>
> On Thu, Aug 11, 2016 at 12:44 PM, Zhao Xin <owenzx@gmail.com> wrote:
>
> > I try to change command line tool from Xcode 8.0(8S193k) to Xcode
> > 7.3.1(7D1014), who lead me to swift 3.0 or swift 2.2. I need Swift
2.3 to
> > build Realm Cocoa from its source.
> >
> > Any idea?
> >
> > Zhaoxin
> >

> _______________________________________________
> swift-users mailing list
> swift-users@swift.org
> https://lists.swift.org/mailman/listinfo/swift-users

_______________________________________________
swift-users mailing list
swift-users@swift.org
https://lists.swift.org/mailman/listinfo/swift-users