MoonPoint Support Logo


Shop Amazon Warehouse Deals - Deep Discounts on Open-box and Used ProductsAmazon Warehouse Deals

Advanced Search
Sun Mon Tue Wed Thu Fri Sat

Tue, Apr 21, 2015 11:25 pm

Checking the battery temperature for a MacBook Pro laptop

I wanted to check the temperature of components in a MacBook Pro laptop running OS X 10.8.5, aka Mountain Lion, from the command line. A Bash script by jondthompson, which is a fork of a script posted by earlonrails, to check the battery temperature that can be run from a Terminal window can be found at GitHub Gist at I've also included the code below.
# battery_temperature for mac osx 10.9.2
if [ `uname` == "Darwin" ]; then

if [ "$1" == "-h" ]; then
echo "Usage: $(basename $0 ".sh") [option]"
echo " -l also show Model Name and Processor Name"
echo " -h display this help message"

# -l display Model Name and Processor Name
if [ "$1" == "-l" ]; then
system_profiler SPHardwareDataType | awk '/Model Name/ || /Processor Name/' | sed 's/[^:]*: //' | awk '{ printf $0 " " }'

# sensor data
temperature=`ioreg -r -n AppleSmartBattery | grep Temperature | cut -c23-`
temperature_celsius=`echo "scale = 2; $temperature / 100.0" | bc`
echo "AppleSmartBattery Temperature: "
echo $temperature_celsius °C
temperature_fahrenheit=`echo "scale = 2; ($temperature_celsius * (9 / 5)) + 32.0" | bc`
echo $temperature_fahrenheit °F

# error message if unsupported machine
echo -e "\nThis appears not to be an OS X machine\n"

After making the script executable, when I ran it on a 15-inch, Mid 2009 MacBook Pro laptop, I saw the following:

$ chmod +x
$ ./ 
AppleSmartBattery Temperature: 
30.46 °C
86.82 °F

[/os/os-x] permanent link

Once You Know, You Newegg AliExpress by

Shop Amazon Local - Subscribe to Deals in Your Neighborhood

Valid HTML 4.01 Transitional

Privacy Policy   Contact

Blosxom logo