Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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.

thanks

share|improve this question
up vote 15 down vote accepted

There are many ways, but try uname -a.

share|improve this answer
9  
uname -p gives just the processor architecture. man uname for other options. – Doug Harris Jun 3 '10 at 16:55
2  
@DougHarris I get x86_64 with -a but i386 with -p – GP89 Jan 29 '15 at 14:45

arch is available in /usr/bin/arch

You can get OS version information with sw_vers

$ sw_vers
ProductName:    Mac OS X
ProductVersion: 10.6.3
BuildVersion:   10D573
$ sw_vers -productVersion
10.6.3
share|improve this answer

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

share|improve this answer
4  
Not with me. arch outputs i368 and uname -m outputs x84_86. I run OSX on a 64bit machine. – Erik Aigner Dec 18 '12 at 19:35
    
@ErikAigner: Typo, perhaps? Shouldn't it be x86_64? – Dennis Williamson Dec 19 '12 at 6:02
    
Of course arch should return x86_64, that's why it's so strange. But I don't know why. – Erik Aigner Dec 19 '12 at 7:31
1  
Same here: $ uname -m x86_64 $ arch i386 – Davi Lima Jan 21 '15 at 11:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .