Without using the Cocoa direct API, you can use NSTask to execute the system_profiler command-line tool. If you run the tool like "system_profiler SPHardwareDataType", it will give you a smaller result that you can filter to extract the model identifier.
Update
I found an example with sysctl software:
int mib[2]; size_t len = 0; char *rstring = NULL; mib[0] = CTL_HW; mib[1] = HW_MODEL; sysctl( mib, 2, NULL, &len, NULL, 0 ); rstring = malloc( len ); sysctl( mib, 2, rstring, &len, NULL, 0 ); NSLog(@"%s", rstring ); free( rstring ); rstring = NULL;
Sourced from here .
Maurice Kelly
source share