38

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.

Gaff
  • 17,879
  • 14
  • 55
  • 68
Brian Postow
  • 1,235
  • 2
  • 14
  • 22

3 Answers3

47

There are many ways, but try uname -a.

churnd
  • 4,548
  • 24
  • 24
17

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
Doug Harris
  • 25,888
  • 16
  • 76
  • 105
14

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

Dennis Williamson
  • 99,505
  • 17
  • 159
  • 184