OS X: Current CPU temperature on command line
Apple doesn’t provide any easy way to query the temperature and fan speed on an Intel Mac running OS X 10.5+.
You can access the SMC information with the IOKit API, by asking the kernel for a list of registered ‘AppleSMC’ devices. It’s a pain in the ass, but a nice fellow has made a GPL’d program that handles it for you:
It also comes in the bundle with smcFanControl.
It returns raw sensor readings, so here’s a huge one-liner to get the current CPU temperature: