#import <Foundation/Foundation.h>

int main(int argc, const char * argv[]) {
@autoreleasepool {
NSArray *args = [[NSProcessInfo processInfo] arguments];
if ([args count] < ) {
printf("USAGE:\n\tuti <filenameExtension>\nEXAMPLE:\n\tuti jpg png\n");
exit(EXIT_SUCCESS);
} NSArray *extensions = [args subarrayWithRange:NSMakeRange(, [args count] - )];
for (NSString *filenameExtension in extensions) {
NSString *UTI = (__bridge_transfer NSString *)UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (__bridge CFStringRef)filenameExtension, NULL);
NSString *contentType = (__bridge_transfer NSString *)UTTypeCopyPreferredTagWithClass((__bridge CFStringRef)UTI, kUTTagClassMIMEType);
printf("%s\nUTI: %s\nContentType: %s\n",[filenameExtension UTF8String] , [UTI UTF8String], [contentType UTF8String]);
}
}
return ;
}

--demo--

$ uti jpg png
jpg
UTI: public.jpeg
ContentType: image/jpeg
png
UTI: public.png
ContentType: image/png
05-11 22:10