How do I run a terminal command in a Swift script? (e.g. xcodebuild)
If you would like to use command line arguments “exactly” as you would in command line (without separating all the arguments), try the following. (This answer improves off of LegoLess’s answer and can be used in Swift 5) import Foundation func shell(_ command: String) -> String { let task = Process() let pipe = Pipe() … Read more