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
.
Related videos on Youtube
Author by
Brian Postow
Updated on September 17, 2022Comments
-
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 almost 14 years
uname -p
gives just the processor architecture.man uname
for other options. -
Era over 11 yearsNot with me.
arch
outputsi368
anduname -m
outputsx84_86
. I run OSX on a 64bit machine. -
Dennis Williamson over 11 years@ErikAigner: Typo, perhaps? Shouldn't it be
x86_64
? -
Era over 11 yearsOf course
arch
should returnx86_64
, that's why it's so strange. But I don't know why. -
Davi Lima over 9 yearsSame here: $ uname -m x86_64 $ arch i386
-
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.