It is possible. Use the Command Line Tool template in Xcode when creating a project.
A quick example might be:
#import <Foundation/Foundation.h> int main (int argc, const char * argv[]) { @autoreleasepool { char input[50]; while (true) { // take the argument as an NSString NSLog(@"Enter some text please: "); fgets(input, sizeof input, stdin); NSString *argument = [[NSString stringWithCString:input encoding:NSUTF8StringEncoding] stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]; // do something with the NSString. NSString *uppercase = [argument uppercaseString]; // clear the terminal screen. system("clear"); // output the manipulated screen. NSLog(@"Hello, %@!", uppercase); } } return 0; }
Frank source share