An Apple System Management Controller (SMC) library & command line tool in Swift for Intel based Macs. The library works by talking to the AppleSMC.kext (kernel extension), the private driver for the SMC. Read temperature sensors, get and set fan speed (RPM), and more.
"The System Management Controller (SMC) is an internal subsystem introduced by Apple Inc. with the introduction of their new Intel processor based machines in 2006. It takes over the functions of the SMU. The SMC manages thermal and power conditions to optimize the power and airflow while keeping audible noise to a minimum. Power consumption and temperature are monitored by the operating system, which communicates the necessary adjustments back to the SMC. The SMC makes the changes, slowing down or speeding up fans as necessary." -via Wikipedia
For more see:
Make sure to use the recursive option on clone to initialize all submodules.
git clone --recursive https://github.com/beltex/SMCKit
Incase you have already cloned the repository, run the following inside the project directory.
git submodule update --init
A macOS command line tool for interfacing with the SMC using SMCKit. The CommandLine library is used for the CLI and ronn for generating the manual page.
This will build SMCKitTool (smckit(1)
) from source and place the binary and manual page in your path.
$ smckit -- Temperature -- AMBIENT_AIR_0 34.0°C CPU_0_DIE 48.0°C CPU_0_PROXIMITY 39.0°C ENCLOSURE_BASE_0 29.0°C ENCLOSURE_BASE_1 29.0°C ENCLOSURE_BASE_2 28.0°C HEATSINK_1 34.0°C MEM_SLOTS_PROXIMITY 36.0°C PALM_REST 27.0°C -- Fan -- [id 0] Right Side Min: 1299 RPM Max: 6199 RPM Current: 1292 RPM -- Power -- AC Present: true Battery Powered: false Charging: false Battery Ok: true Battery Count: 1 -- Misc -- Disc in ODD: false
SMC.swift
file must simply be included in your project as another source file. See SwiftInFlux/Runtime Dynamic Libraries for more information and both SMCKitTool & dshb as examples of such a case.There are many projects that interface with the SMC for one purpose or another. Credit is most certainly due to them for the reference. Such projects as:
Handy I/O Kit references:
This project is under the MIT License.
While the SMC driver is closed source, the call strucutre and definition of certain structs needed to interact with it (see SMCParamStruct
) happened to appear in the open source Apple PowerManagement project at around version 211, and soon after disappeared. They can be seen in the PrivateLib.c file under pmconfigd
. In the very same source file, the following snippet can be found:
// And simply AppleSMC with kCFBooleanTrue to let them know time is changed. // We don't pass any information down. IORegistryEntrySetCFProperty( _smc, CFSTR("TheTimesAreAChangin"), kCFBooleanTrue);
Almost certainly a reference to Bob Dylan's The Times They Are a-Changin' :)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4