PROGRAMMING / TECHNOLOGY

How To Create A Command Line App In Xcode (Including Testing)

The missing manual of how to make a testable Command Line Tool with swift

synapticloop
7 min readOct 28, 2022

--

Image by Author

Most of the advice for Swift and MacOS and Xcode focuses on building an iOS application and, less frequently, a MacOS application.

Apple has focussed its efforts and documentation on these two approaches — leaving the humble command line executable behind.

This article will run through

  • Creating a new ‘Command Line Tool’ project,
  • Adding unit tests to it

(along with some hand hints and tips)

So, here goes

The New Project

Boot up Xcode

File -> New -> Project...

Click on the Next button

--

--