Incidentally, on a Mac, this will give you your number of cores, along with other handy stuff:
system_profiler SPHardwareDataType
Hardware:
Hardware Overview:
Model Name: MacBook Pro
Model Identifier: MacBookPro5,1
Processor Name: Intel Core 2 Duo
Processor Speed: 2.4 GHz
Number of Processors: 1
Total Number of Cores: 2
L2 Cache: 3 MB
Memory: 4 GB
Bus Speed: 1.07 GHz
Boot ROM Version: MBP51.007E.B05
SMC Version (system): 1.41f2
Serial Number (system): [snip]
Hardware UUID: [snip]
Sudden Motion Sensor:
State: Enabled
system_profiler SPHardwareDataType
Hardware: