Apple model identifiers
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
LICENSE
README.md
model-identifiers.plist

README.md

model-identifiers

Apple model identifiers. Gives you an approximation of the device based on the model identifier.

Each entry provides the following information (if available):

  • Device - the device name (eg. MacBook Pro, iPad 2, iPad Air)
  • Generation - device generation (eg. Late 2006)
  • Variant - variants within the same generation (eg. 17-inch, Retina)

About

Created by Joris Kluivers (@kluivers on Twitter).

When using this file consider:

  • Bitcoin: 1AKhoHUVfcQ3E5PApytySgDwPgL3PpbyoF
  • Litecoin: LZyxW1Czfrrf7hfst6qztMgpWDxpeXDAjp

Find the identifier

To find your Mac model identifier, on the command line try:

$ sysctl -n hw.model

or in code:

#include <sys/types.h>
#include <sys/sysctl.h>

#if TARGET_OS_IPHONE
    char *propertyName = "hw.machine";
#else
    char *propertyName = "hw.model";
#endif

size_t size;

// Mac: use 'hw.model'. On iOS use 'hw.machine'
sysctlbyname(propertyName, NULL, &size, NULL, 0);

char *model = malloc(size);
sysctlbyname(propertyName, model, &size, NULL, 0);

// model identifier as NSString
NSString *modelIdentifier = [NSString stringWithCString:model encoding:NSUTF8StringEncoding];

free(model);

Identifier Uniqueness

Be aware that a single identifier may refer to multiple models from different years or with different characteristics. In this case the Generation and/or the Variant could not be determined exactly and the key may be missing.

Somewhere around 2010 this practice was changed and from that point on most models have their own unique identifier.

Sources

Related Apple support pages: