Mine
public text v1 · immutableio_service_t platformExpert = IOServiceGetMatchingService(kIOMasterPortDefault, IOServiceMatching("IOPlatformExpertDevice"));
if (platformExpert) {
CFTypeRef serialNumberAsCFString = IORegistryEntryCreateCFProperty(platformExpert, CFSTR(kIOPlatformSerialNumberKey), kCFAllocatorDefault, 0);
if (serialNumberAsCFString) {
NSLog(@"SN: %@",serialNumberAsCFString);
}
IOObjectRelease(platformExpert);
}