Swiftpack.co - Package - eneko/System



Release Swift 4.1 Build Status codecov Swift Package Manager Compatible Linux Compatible

Easily execute system commands from a Swift script or command line tool.


  • ✅ Easily execute child processes with or without capturing output
  • ✅ Easily execute shell commands with or without capturing output
  • ✅ Option to capture output or stream to stdout/stderr in real time
  • ✅ Swift Package Manager compatible
  • ✅ Linux compatible 🐧

Executing child Processes from Swift scripts and CLI tools ✈

Running child processes in Swift is not hard with Process, but it can be a bit tedious and repetitive if done multiple times in the same script or command line tool.

system makes this process extremely easy. If you are familiar with Ruby scripting (Rakefile, Fastlane, Danger, etc), you will feel like home.

Automatically redirect output to stdout 💻

import System

try system(command: "echo hello world") // prints "hello world" to stdout

Capture process output ✇

import System

let output = try system(command: "echo hello world", captureOutput: true).standardOutput
print(output) // prints "hello world"

Check if process terminated gracefully ✔️

import System

print(try system(command: "echo hello world").success) // prints "true"

Easily execute Shell commands with pipes and redirects |>

import System

try system(shell: "echo hello cat > cat && cat cat | awk '{print $2}'") // prints "cat" to stdout


Add System to your Package.swift:

import PackageDescription

let package = Package(
    name: "YourPackage",
    dependencies: [
        .package(url: "git@github.com:eneko/System.git", .branch("master")),
    targets: [
            name: "YourTarget",
            dependencies: ["System"]),

Contact 💌

Follow and/or contact me on Twitter at @eneko.

Contributions 👏

If you find an issue, just open a ticket on it. Pull requests are warmly welcome as well.

License 👮‍♂️

System is licensed under the MIT license. See LICENSE for more info.


Stars: 3
Help us keep the lights on

Used By

Total: 0


0.1.0 - Jul 5, 2019

  • Dependency updates

0.0.1 - Aug 29, 2018

Initial release