How to retrieve device model name via sysctl

Model Name: MacBook Air Model Identifier: Mac17,3

I know it's possible to retrive model-identifier by running the command "sysctl hw.model", but is there another key to retrieve the model-name? ("MacBook Air" instead of "Mac17,3")

Thanks for the post, what about to retrieve the friendly model name from the command line, I normally use system_profiler.

 system_profiler SPHardwareDataType | grep "Model Name"

Or we can just remove the label with:

system_profiler SPHardwareDataType | awk -F': ' '/Model Name/ {print $2}'

Hope this helps.

Resources: https://discussions.apple.com/thread/5988473

https://discussions.apple.com/docs/DOC-250009356

Albert
  Worldwide Developer Relations.

@hoppedevz

Actually that API has some limitations and I should not have recommended. May I ask you to file an enhancement request for that to get something you can use better than system_profiler ?

Once you file the request, please post the FB number here.

If you're not familiar with how to file enhancement requests, take a look at Bug Reporting: How and Why?

Albert
  Worldwide Developer Relations.

How to retrieve device model name via sysctl
 
 
Q