I was building a simple Command Line Tool app for macOS. One thing the app needed was user input, i.e. it should wait for the user to type something that I’d like to make use of in the app.
Turns out it’s a rather complicated affair, and I haven’t found a comprehensive starter guide on how to actually accomplish this.
I wanted to create a Command Line Tool app that was capable of accepting text input from the Terminal window, use it, and then write output back for the user to read.
But that wasn’t enough: I also had to tell Xcode to setup the app appropriately, otherwise the Terminal window wasn’t launched – which is of course necessary for a Common Line Tool.
In this article we’ll do just that: prepare Xcode to launch Terminal, wait for input, and print it out again. Here we go.