Determine the architecture of a Mac from the command line or script?

53,889

Solution 1

There are many ways, but try uname -a.

Solution 2

uname -m seems to output the same information as /bin/arch.

Share:
53,889

Related videos on Youtube

Brian Postow
Author by

Brian Postow

Updated on September 17, 2022

Comments

  • Brian Postow
    Brian Postow over 1 year

    I'm writing a shell script, and I need to know the architecture, i.e. PPC or Intel. Back in the day, there was a program /bin/arch that told you, but my Mac doesn't seem to have it.

    Is there an easy way I can do this? Grep for something in a logfile? Call some other program that spits that out as a side effect?

    It would be nice to know what OS version I'm running too, but that may not be necessary.

  • Doug Harris
    Doug Harris almost 14 years
    uname -p gives just the processor architecture. man uname for other options.
  • Era
    Era over 11 years
    Not with me. arch outputs i368 and uname -m outputs x84_86. I run OSX on a 64bit machine.
  • Dennis Williamson
    Dennis Williamson over 11 years
    @ErikAigner: Typo, perhaps? Shouldn't it be x86_64?
  • Era
    Era over 11 years
    Of course arch should return x86_64, that's why it's so strange. But I don't know why.
  • Davi Lima
    Davi Lima over 9 years
    Same here: $ uname -m x86_64 $ arch i386
  • GP89
    GP89 over 9 years
    @DougHarris I get x86_64 with -a but i386 with -p
  • 廖茂生
    廖茂生 over 3 years
    @GP89 Have the same condition with you.