Download Swift

The latest stable Swift release is Swift 0.94.1.

  1. Download the file from http://swiftlang.org/packages/swift-0.94.1.tar.gz.

  2. Extract by running "tar xfz swift-0.94.1.tar.gz"

  3. Add to PATH by running "export PATH=$PATH:/path/to/swift-0.94.1/bin"

Run Swift

Example Swift scripts can be found in the swift-0.94.1/examples directory. Scripts have a .swift file extension. Run the following commands to run a simple hello world application.

cd swift-0.94.1/examples/
swift hello.swift

When you run this application, it should create a file called hello.txt. If this file gets created, you have successfully ran your first Swift script!

More documentation on how to run Swift can be found at http://www.ci.uchicago.edu/swift/docs/index.php.