Command to get Model Identifier - MacRumors Forums
Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > OS X

Reply
 
Thread Tools Search this Thread Display Modes
Old Apr 19, 2012, 01:01 PM   #1
rafperez
macrumors newbie
 
Join Date: Apr 2012
Command to get Model Identifier

Greetings fellow Mac users.

I know where to find the Model Id, but I want to know the command in Terminal to get the Model Id. Just the Id.

So far I have found the following commands:
system_profiler | grep "Model Id" and sysctl hw.model
But both return more than I want. I just want the command to return "MacBookPro8,2"
if you use the above commands, you'll see that they return:
"ModelIdentifier: MacBookPro8,2" and "hw.model: MacBookPro8,2"

I have something to get just the Serial Number and it works great:
ioreg -l | awk '/IOPlatformSerialNumber/ { split($0, line, "\""); printf("%s\n", line[4]); }'

But since I'm a Mac noob I don't know what I can modify in the ioreg command to get the Model Id. Any assistance would be appreciated!
rafperez is offline   0 Reply With Quote
Old Apr 19, 2012, 01:45 PM   #2
Bear
macrumors G3
 
Join Date: Jul 2002
Location: Sol III - Terra
This should do what you want:
Code:
ioreg -l | awk '/product-name/ { split($0, line, "\""); printf("%s\n", line[4]); }'
__________________
-----Bear
Bear is offline   0 Reply With Quote
Old Apr 23, 2012, 05:18 PM   #3
rafperez
Thread Starter
macrumors newbie
 
Join Date: Apr 2012
Thanks for your replay Bear.

Awesome sir! exactly what I needed. Being a noob I was all over the place, I was just looking at sed, but I don't think I was in the same ball park. Excellent, thanks again.
rafperez is offline   0 Reply With Quote
Old Dec 16, 2012, 07:17 PM   #4
pra
macrumors newbie
 
Join Date: Dec 2012
sysctl -n hw.model
pra is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > OS X

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Similar Threads
thread Thread Starter Forum Replies Last Post
Strange model identifier yjchua95 iMac 2 Nov 2, 2013 03:43 AM
Undeclared identifier in UIAlertView Kapthehat iPhone/iPad Programming 2 Sep 2, 2013 06:19 AM
Get Full Model Name from the Command Line cranfordio OS X 3 Mar 21, 2013 01:07 PM
12,5 will be the model identifier of the new iMac Puevlo iMac 5 Sep 4, 2012 11:35 PM
Is 2012 mac pro get new model identifier(Macpro6,1)? Amethyst Mac Pro 7 Jun 15, 2012 12:02 AM

Forum Jump

All times are GMT -5. The time now is 09:25 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC