How to run Swift from Command Line Jun 16, 2015 • Daniel Vela To run a Swift script in Terminal type the following: $ swift fileName.swift Alternatively you can put the following line of text at the top of the script file and run that file #!/usr/bin/env xcrun --sdk swift