When you create a Command Line Tool project in Xcode you get this, in main.m:
#import int main(int argc, const char * argv[]) {
You can have the terminal launch everytime you run the application through editing the scheme. I believe this became available from Xcode 8.0.
Access Edit Scheme
Edit Scheme
Switch Console from Use Xcode to Use Terminal
Console
Use Xcode
Use Terminal