lavoiesl / osx-cpu-temp Goto Github PK
View Code? Open in Web Editor NEWOutputs current CPU temperature for OSX
License: GNU General Public License v2.0
Outputs current CPU temperature for OSX
License: GNU General Public License v2.0
The current SMC keys to obtain the GPU temperatures are not working anymore. Seems like Catalina changed the keys.
Running macOS Catalina 10.15.6
on MacBookPro16,2
> ./osx-cpu-temp -g
0.0 °C
It should return the temperature of the GPU
> ./osx-cpu-temp -g
52.5 °C
I think there is an error with the key that is searched.
Line 59 in 57aadd7
kIOMasterPortDefault
for macos < 12.0?~❯ clib install lavoiesl/osx-cpu-temp
fetch : lavoiesl/osx-cpu-temp:package.json
gzip: osx-cpu-temp-0.0.0.tar.gz: not in gzip format
sh: line 0: cd: /var/folders/sw/j7lqmx85253dcbvjw78p4d7c0000gn/T//osx-cpu-temp-0.0.0: No such file or directory
Get fan speed but returns fan number
osx-cpu-temp -f
Num fans: 2
FakBook:~ lillecarl$ /usr/local/bin/osx-cpu-temp
Error: IOServiceOpen() = e00002c7
0.0°C
(If more info is needed tell me what you'll need and I'll get it :))
how to get iphone cpu temperature,this project maybe only work for mac?
Hey,
I'm running osx-cpu-temp on Catalina (10.15.2) on a 2015 MacBook Pro 13".
Recently I have noticed that temperatures only update whilst my Mac is connected to power.
There was about a 5-10 second wait between each command in the test below:
~ $ echo Running off battery
Running off battery
~ $ osx-cpu-temp
42.9°C
~ $ osx-cpu-temp
42.9°C
~ $ osx-cpu-temp
42.9°C
~ $ echo Charger connected
Charger connected
~ $ osx-cpu-temp
39.0°C
~ $ osx-cpu-temp
38.8°C
~ $ osx-cpu-temp
38.5°C
It seems that this issue occurs whilst using iStats also. However Intel power gadget is working just fine.
This is very strange as a couple of weeks ago it was working fine.
Is anybody else experiencing this issue?
Thanks
I have an older macmini (some details below). The compiler wouldn't work without this small change:
215c215,216
< for (int i = 0; i < 10; i++) {
---
> int i;
> for (i = 0; i < 10; i++) {
231c232,233
< for (int i = 0; i < nfans; i++) {
---
> int i;
> for (i = 0; i < nfans; i++) {
I guess the compiler doesn't allow declarations in the "for loop". This small change allows it to compile and run.
-Chris
Hardware Overview:
Model Name: Mac mini
Model Identifier: Macmini1,1
Processor Name: Intel Core Duo
Processor Speed: 1.66 GHz
Number Of Processors: 1
Total Number Of Cores: 2
L2 Cache: 2 MB
Memory: 2 GB
Bus Speed: 667 MHz
Software:
System Software Overview:
System Version: Mac OS X 10.6.8 (10K549)
Kernel Version: Darwin 10.8.0
I'm running MacOS 10.12.2. I don't know if there already existed a /usr/local/bin folder, but after compiling your program, I ran "sudo make install" and then listed the contents of /usr/local/bin and was informed it was not a folder, but an executable file. So I ran it and it was the temperature program. I renamed it to osx-cpu-temp, then created a new /usr/local/bin directory, then moved it in there. It works fine now but I'm afraid the "sudo make install" command might have overwritten /usr/local/bin with your program. You might want to check on this. Thank you for the program.
$ git clone https://github.com/lavoiesl/osx-cpu-temp.git
(…)
$ make
cc -O2 -Wall -framework IOKit -o osx-cpu-temp smc.c
$ ./osx-cpu-temp
0.0°C
$ uname -a
Darwin mbf.local 13.0.0 Darwin Kernel Version 13.0.0: Thu Sep 19 22:22:27 PDT 2013; root:xnu-2422.1.72~6/RELEASE_X86_64 x86_64
The current values of the temperature for the CPU is taken from the Proximity sensor (located on the CPU Cooler). Obviously, the CPU Cooler is cooler than the CPU die. Overheating and temperature throttling is related to the temperature of the cores. This is why Intel Power Gadget is using the values from the cores (I think it is making an average since each core has its temperature but it is only showing one value). Unless it is under serious work, the Proximity sensor will always be lower by 5-20°C.
Running macOS Catalina 10.15.6
on MacBookPro16,2
> ./osx-cpu-temp
45.4 °C
It should return the temperature of the GPU
> ./osx-cpu-temp
55.3 °C
Change the SMC key to one of the cores, preferably the first or second one to ensure compatibility on dual-core processors (or take the average of all the cores available).
Bonjour M. Lavoie,
I had to change in smc.c :
result = IOServiceGetMatchingServices(kIOMainPortDefault, matchingDictionary, &iterator);
to:
result = IOServiceGetMatchingServices(kIOMasterPortDefault, matchingDictionary, &iterator);
to get it to make it :-), and run fine.
Thank's
jrb.
Hey there,
I wrote a Homebrew formula for your program, in case someone doesn't want to use CLibs.
You can access it with:
brew tap gwerbin/homebrew-tap
brew install osx-cpu-temp
I wrote it for personal use, but if you're interested I can make a PR to the Hombrew team. Tagging a release (even if it's a meaningless 0.1.0 or 1.0.0) would help, so it doesn't get relegated to the HEAD-only tap.
Hey,
I've recently found out about this project, really enjoying it and it is working perfectly for CPU temp, but it seems to be buggy when talking about fan info
❯ osx-cpu-temp -f
Num fans: 1
Fan 0 - Exhaust at 0 RPM (0%)
I've added this info to the bottom of my console so It's running that command every 5 seconds and I see the the 0 RPM (0%)
most of the time, altough sometimes it seems to render accurate data.
Is there a way to integrate this osx-cpu-temp with the htop tool?
Hello there! First off, great tool, works quite well!
I have a question about following code snippet:
Line 275 in af036f7
What is it supposed to do? I ask because a few lines further up in that method you have read from SMCGetFanRPM(key) into local variables for minimum, maximum and actual (fan)speeds. I seem to find the variable actual_speed seems to be quite plausible on my machine, so i was wondering what your line of thought might be?
I am using a Macmini3,1 (thats a late 2009 mac mini, i think) on OS X El Capitan 10.11.6 and it is reporting "Fan 0 - Master at 318 RPM (8%)", which seems a little low. The actual_speed variable is reading 1818, which seems quite plausible.
Built/ran the current code on a Mac mini (Mid 2011) running macOS 10.13.6 with Xcode 10.1. It doesn't seem to be able to read the fan speed.
osx-cpu-temp $ ./osx-cpu-temp -F
128.5°F
osx-cpu-temp $ ./osx-cpu-temp -f
Num fans: 1
Fan 0 - Exhaust at 0 RPM (0%)
The fan is working, and the app "Macs Fan Control" shows that the current RPM is right around 1800 (the fan's minimum speed). I also tried smcFanControl and that shows a correct-looking RPM value, too.
Please help?
Thanks
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.