Google is failing me, so I decided to ask here...
How can you tell, from the command line, how many cores are on the machine when you're running Mac OS X? On Linux, I use:
x=$(awk '/^processor/ {++n} END {print n+1}' /proc/cpuinfo)
It's not perfect, but it's close. This is intended to get fed to make
, which is why it gives a result 1 higher than the actual number. And I know the above code can be written denser in Perl or can be written using grep, wc, and cut, but I decided the above was a good tradeoff between conciseness and readability.