Macbook Pro system fan speed control via API

Hi, I recently got myself a Macbook Pro and noticed that the CPU on it tends to run really hot under nominal loads which is leading to thermal throttling.

So, I started looking into ways I can get the CPU die temperature and modify the current fan speed curve. My goal is to create a background process that basically overrides the current default of 0 rpm for temperatures below 42 C and reverts to system default for higher temperatures.

powermetrics command gave me the temperature and fan speed information that I needed. But, I haven't found anything that would allow me to change the fan curve or set a particular rpm value via a terminal command or hardware level APIs. Can anyone please provide me some information around it?


Replies

AFAIK, there is no such API. And tweaking fan speed may put the Mac at risk.
It's controlled by the SMC, now in the T1/T2 chips. If you want to investigate on Intel/ACPI machines, extracting one of the SSDTs should essential reveal the fan response curve, but it's not meant to be configurable. Having said that, Macs tend to favor silent operation where possible.
From what you describe, it sounds like an app may be misbehaving by either spinning where it shouldn't, or failing to respond to the thermal notifications.
Thanks guys, after searching for some solutions to communicate with the SMC, I came across this Github project : https://github.com/beltex/libsmc

The library allows me to communicate with the SMC by wrapping around utility functions that interact with AppleSMC.kext. However, Apple last year announced that it would start deprecating kernel extensions gradually in favor of system extensions.

So, I am thinking I can create a fork that uses system extensions instead to verify the POC. That would allow me to create a MVP service that can be used to manually set fan speeds when I feel like I need to override system default. To make life easier I can have a menu bar status icon for quickly enabling and disabling the override and set the fan speed.

That way the default fan curve can stay as is. But, I also don't end up with a system that's got hard to repair electronics staying at high temperatures for extended periods.
  • did u end up making a fork? Or an app?

Add a Comment