Skip to content
Blake Merryman edited this page Jan 29, 2015 · 1 revision

Setup For Use & Development

In order to use[^1] or develop a Swift script, you will need to have Xcode 6 installed and set as your default development environment. Xcode 6 requires at least Mac OS X Mavericks (v.10.9.4), though Yosemite (v.10.10.1) is recommended.

As of January 11, 2014, if you have the latest versions of Xcode (v.6.1.1) and Yosemite (v.10.10.1) installed and Xcode 6 is set as the default development environment, there is zero further configuration required to get started.

If this is not the case, or you are not sure, please continue reading.

Checking Default Xcode Version

To check which version of Xcode is set as the default on your system, enter the following command into the Terminal:

$ xcodebuild -version

which should return something like:

Xcode 6.1.1
Build version 6A2008a

Changing Default Xcode Version

If you need to switch your active version of Xcode, run the following terminal command:

$ sudo xcode-select -switch /Application/.../Xcode.app/Contents/Developer

where /.../ is the path to the correct version of Xcode.

Creating Aliases to the Proper Swift Tools

If you are not running the newest versions of Xcode and OS X, it is suggested that you create aliases to several Swift tools for convenience and consistency. The aliases will simulate the behavior of the most current versions of Xcode & OS X.

For example, to access the primary Swift environment, swift:

# With Xcode 6.1.1 & OS X 10.10.1
$ swift helloWorld.swift

# With Xcode 6._._ & OS X 10._._
$ 

[^1]: An interpreted script makes a on-the-fly call into the Swift Environment (embedded in Xcode) in order to compile and run. If you have downloaded a compiled binary (a.k.a Command Line Tool), it should run whether Xcode is installed or not, assuming your system can handle it.

Clone this wiki locally