Last Updated: October 18, 2020
· itseranga

Swift from command line


Swift is new programming language to build IOS/OSX application which invented by apple. It is modern and type-safe programming language for Cocoa developments.

More info

Swift can be use as a general purpose OS scripting language. One of its main advantage is, its capability to used on command line.

Swift REPL

Read-Eval-Print-Loop(REPL) is language shell which allow developers to interact with swift codes from command line(as like python command line shell). It's capable to execute blocks of swift codes in an interactive way from the command line.

Swift from command line

  • First need to download and install new Xcode6-Beta(It comes with Swift)

  • Then add an alias to your ~/.bash_profile(if you are using bash shell) to easily access REPL(Swift)

  • If you are using zsh shell add the alias to ~/.zshrc

alias swift="/Applications/"
  • Then execute command swift from a terminal. It will starts REPL session. Form their you can interact with swift.


1 Response
Add your response

Doesn't work with Xcode 6 from AppStore.
Doesn't contain correct MacOSX SDK

over 1 year ago ·