Device model name in readable format
I would like to know if there is a reliable/foolproof method to obtain the URL "About This Mac" directs you to when clicking "Specifications" or "Hardware Support"
I am aware of the curl request:
curl -o - "http://support-sp.apple.com/sp/product?cc=DHJP&lang=en_US"
So, for this request, it shows my particular model based on the last 4 characters of my serial:
curl -o - "http://support-sp.apple.com/sp/product?cc=DHJP&lang=en_US"
<?xml version="1.0" encoding="utf-8" ?><root><name>CPU Name</name><configCode>iMac (27-inch, Mid 2011)</configCode><locale>en_US</locale></root>
The thing is, Apple has also used the same request for other systems using only the last 3 characters in the url. And if I only use the last 3 digits of MY serial in this request, curl returns an incorrect model:
curl -o - "http://support-sp.apple.com/sp/product?cc=HJP&lang=en_US"
<?xml version="1.0" encoding="utf-8" ?><root><name>CPU Name</name><configCode>Power Mac G4 (PCI Graphics)</configCode><locale>en_US</locale></root>
Basically, I am trying to do an Alfred2 workflow, that will grab the actual serial number with:
system_profiler SPHardwareDataType | grep 'Serial Number (system)' | awk '{print substr( $0, length($0) - 3, length($0) ) }'
Then, I am sending the last 4 digits into the workflow so that a person can just hit a modifier to goto the appropriate website for either technical specs on their model or the support site for their model ... just like "About This Mac" / "More Info" / "Support" > Specifications does.
IS there a more reliable way to get the model identifier so that the link selected will always return the correct url, regardless of the current 3 or 4 character rules?
iMac, OS X Mountain Lion (10.8.3)