<p>I have a program which needs to behave slightly differently on Tiger than on Leopard. Does anybody know of a system call which will allow me to accurately determine which version of Mac OS X I am running. I have found a number of macro definitions to determine the OS of the build machine, but nothing really good to determine the OS of the running machine.</p>

<p>Thanks,
Joe</p>

In terminal:
```
```
system_profiler SPSoftwareDataType
```
```
Gives:
```
```
Software:

    System Software Overview:

      System Version: Mac OS X 10.5.5 (9F33)
      Kernel Version: Darwin 9.5.0
      Boot Volume: Main
      Boot Mode: Normal
      Computer Name: phoenix
      User Name: Douglas F Shearer (dougal)
      Time since boot: 2 days 16:55
```
```
Or:
```
```
sw_vers
```
```
Gives:
```
```
ProductName:    Mac OS X
ProductVersion: 10.5.5
BuildVersion:   9F33
```
```