Code Monkey home page Code Monkey logo

smctemp's Introduction

smctemp

Print CPU and GPU temperatures on macOS.

It works on following macs.

  • arm64 (M3 mac)
  • arm64 (M2 mac)
  • arm64 (M1 mac)
  • x86_64

Acknowledgements

I took the code from hholtmann/smcFanControl/smc-command and modified it to specialize in temperature acquisition. Some of the sensor values were obtained from the exelban/stats project.

How to Use

$ git clone https://github.com/narugit/smctemp
$ cd smctemp
$ sudo make install
$ smctemp -c

Usage

$ smctemp -h
Check Temperature by using Apple System Management Control (Smc) tool 0.5.0
Usage:
./smctemp [options]
    -c         : list CPU temperatures (Celsius)
    -g         : list GPU temperatures (Celsius)
    -h         : help
    -i         : set interval in milliseconds (e.g. -i25, valid range is 20-1000, default: 1000)
    -l         : list all keys and values
    -f         : fail-soft mode. Shows last valid value if current sensor read fails.
    -v         : version
    -n         : tries to query the temperature sensors for n times (e.g. -n3) until a valid value is returned

$ smctemp -c
64.2

$ smctemp -g
36.2

Note for M2 Mac Users

On M2 Macs, sensor values may be unstable as described in the following issue:

For M2 Macs, using the -n, -i, and -f options can help obtain more stable sensor values. Try tuning these options to get better results.

The recommended settings are -i25 -n180 -f (See also https://github.com/narugit/smctemp/pull/34/files#r1721025001)

smctemp's People

Contributors

enen92 avatar jrabinow avatar kyleyannelli avatar narugit avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

smctemp's Issues

Integration in my script

Hi, I noticed your project; you made a really great work.
I'd like to integrate your code in my script that you can find here.
My script uses a bunch of sensors to get computer data and sends them to remote smart home hubs, so you can use it to monitor your devices.

I'm writing you since my project uses a GPLv3 license, while yours uses a GPLv2, which prevents me from using your code.
Do you allow me to use it in my project, changing your license to GPLv3 or simply to a "GPLv2 or any later version" ?

Thank you for your time.
Hope to hear from you soon,
RB

Apple M2 Max Support (Macbook Pro 2023 14")

Hi!

Thanks again for this great tool.

The new "Apple M2 Max", which Macbook Pros can come with, seems to report the temperature wrong, where it's /10?.

smctemp -c

3.4

uname -m

arm64

sysctl -in sysctl.proc_translated

0

smctemp -l | grep -i "t[cp]0"

  Tp00  [flt ]  0.0 (bytes: 00 00 00 00)
  Tp01  [flt ]  6.7 (bytes: 66 66 D6 40)
  Tp02  [flt ]  8.4 (bytes: CD CC 06 41)
  Tp04  [flt ]  0.0 (bytes: 00 00 00 00)
  Tp05  [flt ]  4.6 (bytes: 89 41 94 40)
  Tp06  [flt ]  5.3 (bytes: 66 66 AA 40)
  Tp08  [flt ]  0.0 (bytes: 00 00 00 00)
  Tp09  [flt ]  6.7 (bytes: 66 66 D6 40)
  Tp0A  [flt ]  8.4 (bytes: CD CC 06 41)
  Tp0C  [flt ]  0.0 (bytes: 00 00 00 00)
  Tp0D  [flt ]  4.6 (bytes: 89 41 94 40)
  Tp0E  [flt ]  5.3 (bytes: 66 66 AA 40)
  Tp0W  [flt ]  0.0 (bytes: 00 00 00 00)
  Tp0X  [flt ]  6.7 (bytes: 66 66 D6 40)
  Tp0Y  [flt ]  8.4 (bytes: CD CC 06 41)
  Tp0a  [flt ]  0.0 (bytes: 00 00 00 00)
  Tp0b  [flt ]  4.6 (bytes: 89 41 94 40)
  Tp0c  [flt ]  5.3 (bytes: 66 66 AA 40)
  Tp0e  [flt ]  0.0 (bytes: 00 00 00 00)
  Tp0f  [flt ]  6.7 (bytes: 66 66 D6 40)
  Tp0g  [flt ]  8.4 (bytes: CD CC 06 41)
  Tp0i  [flt ]  0.0 (bytes: 00 00 00 00)
  Tp0j  [flt ]  4.6 (bytes: 89 41 94 40)
  Tp0k  [flt ]  5.3 (bytes: 66 66 AA 40)
  ftP0  [flt ]  6.7 (bytes: 66 66 D6 40)
  ftp0  [flt ]  30.8 (bytes: B0 12 F6 41)

smctemp -c && smctemp -l > smc_out:

https://gist.github.com/joshuataylor/bb02ed6bad2d9f3bd0fe2e8d478bbd2d

Current workaround: echo $(($(smctemp -c)*10)) 😁

Does not work via SSH?

Hello, I'm not sure if this is a profile or variable issue, but if I try to run smctemp remotely via an ssh session, I get a command not found error:

ssh me@mymac 'smctemp -c'
(me@mymac) Password:
zsh:1: command not found: smctemp

Is there something I need to add to ~/.zshrc to make this work? It works just fine in Terminal directly on the system.

M2 CPU temperature

I came across your repo because on M2 I can't run sudo powermetrics --samplers smc | grep -i "CPU die temperature" to get CPU temperature. I'm not too familiar with C++ but I have a strong programming background. Can you guide me on the process for getting this from the hardware?

I'm looking at the code but I'm having some trouble understanding exactly what's happening. I think this is where it's getting the temp in the code: https://github.com/narugit/smctemp/blob/9b9f73bd7c503f048dfac2bedc917ccefc942d47/smctemp.cc#LL368C25-L368C25

brew formula

Hey, thanks for this binary. Any chance you can set up brew formula for this?

CPU Temp Shows 0.0 | 2023 14", M2 Max (12 Core), Sonoma 14.5

╭─kyannelli::mbp @ ~/smctemp
╰─ » smctemp -c
0.0
╭─kyannelli::mbp @ ~/smctemp
╰─ » smctemp -g
40.3
Screenshot 2024-08-11 at 8 10 58 PM
Model Name:	MacBook Pro
  Model Identifier:	Mac14,5
  Model Number:	Z17J000AKLL/A
  Chip:	Apple M2 Max
  Total Number of Cores:	12 (8 performance and 4 efficiency)
  Memory:	32 GB
  System Firmware Version:	10151.121.1
  OS Loader Version:	10151.121.1

It seems the prior support added for the M2 Max 8 core PR #14 does not work for the 12 core M2 Max.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.