Q:

how to get current device on Mac

Is there  any way to get the device info that user is using?
I just want to know the device is MacBookPro or iMac.
[[NSHost currentHost] localizedName] is used to get info from web.

A:

You can use 
int sysctlbyname(const char *name, void *oldp, size_t *oldlenp, void *newp, size_t newlen);

Take a look at documentation.  
size_t size;
sysctlbyname("hw.model", NULL, &size, NULL, 0);
char *model = malloc(size);
sysctlbyname("hw.model", model, &size, NULL, 0);
NSLog(@"%s", model);

