Model via Terminal

Discussion in 'OS X Mountain Lion (10.8)' started by Äppelskrutt, Aug 6, 2013.

  1. macrumors newbie

    Joined:
    Aug 6, 2013
    #1
    Hi there!

    Does anybody know a terminal command that gives me the the model of my Mac?

    For example; "Late 2009" or "Early 2010".

    That information does not exist in the SystemProfiler (/usr/sbin/system_profiler SPHardwareDataType). But in OS X 10.7 and OS X 10.8 you can see that information in "About this mac".

    This would be very helpful for me.

    Thanks:)
     

    Attached Files:

  2. macrumors G5

    Macman45

    Joined:
    Jul 29, 2011
    Location:
    Somewhere Back In The Long Ago
    #2
    Have you tried the "My Products" support page? If you registered your device with Apple it will appear here with all the info you need
     
  3. macrumors 65816

    Dalton63841

    Joined:
    Nov 27, 2010
    Location:
    SEMO, USA
  4. macrumors member

    Joined:
    Apr 27, 2013
    #4
    sw_vers

    and more information:

    system_profiler | more

    starikarp
    **********
    http://www.redbubble.com/people/lumiwa
     
  5. thread starter macrumors newbie

    Joined:
    Aug 6, 2013
    #5
    Hi,

    Thanks for quick replies.

    Sorry but "sysctl hw.model" is not was I was looking for.

    I need a terminal command that gives me the year and if the model is late or early.

    Example: "Late 2010"

    And I need to get this via terminal.

    Thanks
     
  6. macrumors member

    Joined:
    Apr 27, 2013
    #6
    system_profiler give a lot of information and one of this is also:
    Model Name: iMac
    Model Identifier: iMac11,1
    Processor Name: Intel Core i7
    Processor Speed: 2.8 GHz
    Number of Processors: 1
    Total Number of Cores: 4
    L2 Cache (per Core): 256 KB
    L3 Cache: 8 MB
    Memory: 8 GB
    ...
    ...

    Use grep.
     
  7. thread starter macrumors newbie

    Joined:
    Aug 6, 2013
    #7
    Problem Solved

    Problem solved. Read about it here:

    http://apple.stackexchange.com/ques...model-year-be-determined-via-terminal-command

    If I put this script into Geektool it works great:

    #!/bin/zsh -f

    noglob curl -s http://support-sp.apple.com/sp/product?cc=`system_profiler SPHardwareDataType |\
    awk '/Serial/ {print $4}' |\
    cut -c 9-` |\
    sed 's|.*<configCode>\(.*\)</configCode>.*|\1|'

    exit 0

    Or this one:

    #!/bin/zsh -f

    # Original: http://apple.stackexchange.com/ques...model-year-be-determined-via-terminal-command
    # This version slightly modified to remove XML. (See also: https://gist.github.com/tjluoma/6171647)


    noglob curl -s http://support-sp.apple.com/sp/product?cc=`system_profiler SPHardwareDataType |\
    awk '/Serial/ {print $4}' |\
    cut -c 9-` |\
    sed 's|.*<configCode>\(.*\)</configCode>.*|\1|' |\
    tr '[:cntrl:]' ' ' |\
    sed 's#.*<configCode>##g ; s#</configCode>.*##g'

    exit 0



    Thanks all!
     

    Attached Files:

Share This Page