Accessing Command-Line Swift

You’ll find the command-line version at /Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift

Michele likes ln: sudo ln -s "/Applications/Xcode6-Beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift" /usr/local/bin/swift

I  prefer lns, as I discuss in this writeup

But August, as always, has the last word. Use xcrun swift, he tells me, assuming you did xcode-select to point to the beta.

Bonus tip #1: The -integrated-repl option uses the original built-in repl. Use -repl (or no args) for the new LLDB-based repl. (Thanks Lily Ballard & Eiam)

Bonus tip #2: run with -help or --help for full usage information

 

2 Comments

  • so how do you return an exit code from a swift CLI program? i.e., what’s the equivalent of main?

  • Posting you an answer