{"id":19495075,"url":"https://github.com/iglance/smckit","last_synced_at":"2025-04-25T21:32:22.065Z","repository":{"id":128777826,"uuid":"237024953","full_name":"iglance/SMCKit","owner":"iglance","description":"Apple SMC library \u0026 tool","archived":false,"fork":false,"pushed_at":"2020-12-06T18:16:12.000Z","size":382,"stargazers_count":9,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-04T03:41:12.399Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Swift","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/iglance.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-29T16:08:09.000Z","updated_at":"2025-02-27T05:20:16.000Z","dependencies_parsed_at":null,"dependency_job_id":"fb401df2-a281-40ff-9f8c-8ba60fdb8ea7","html_url":"https://github.com/iglance/SMCKit","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iglance%2FSMCKit","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iglance%2FSMCKit/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iglance%2FSMCKit/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/iglance%2FSMCKit/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/iglance","download_url":"https://codeload.github.com/iglance/SMCKit/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250900169,"owners_count":21505000,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-10T21:35:58.632Z","updated_at":"2025-04-25T21:32:22.059Z","avatar_url":"https://github.com/iglance.png","language":"Swift","funding_links":[],"categories":[],"sub_categories":[],"readme":"SMCKit\n======\n\nAn Apple System Management Controller (SMC) library \u0026 command line tool in Swift\nfor Intel based Macs. The library works by talking to the AppleSMC.kext (kernel\nextension), the private driver for the SMC. Read temperature sensors, get and\nset fan speed (RPM), and more.\n\n- For an example usage of this library, see\n  [dshb](https://github.com/beltex/dshb), a macOS system monitor in Swift\n- For other system related statistics in Swift for macOS, see\n  [SystemKit](https://github.com/beltex/SystemKit)\n\n\n### System Management Controller\n\n_\"The System Management Controller (SMC) is an internal subsystem introduced by\nApple Inc. with the introduction of their new Intel processor based machines\nin 2006. It takes over the functions of the SMU. The SMC manages thermal and\npower conditions to optimize the power and airflow while keeping audible noise\nto a minimum. Power consumption and temperature are monitored by the operating\nsystem, which communicates the necessary adjustments back to the SMC. The SMC\nmakes the changes, slowing down or speeding up fans as necessary.\"_\n-via Wikipedia\n\nFor more see:\n\n- [System Management Controller](https://en.wikipedia.org/wiki/System_Management_Controller)\n- [System Management Unit](https://en.wikipedia.org/wiki/System_Management_Unit)\n- [Power Management Unit](https://en.wikipedia.org/wiki/Power_Management_Unit)\n\n\n### Requirements\n\n- [Xcode 9.0 (Swift 4.0)](https://developer.apple.com/xcode/downloads/)\n- macOS 10.12 Sierra and above **for development** (due to Xcode)\n- OS X 10.9 Mavericks and above **for use** (due to Swift)\n\n\n### Clone\n\nMake sure to use the recursive option on clone to initialize all submodules.\n\n```sh\ngit clone --recursive https://github.com/beltex/SMCKit\n```\n\nIncase you have already cloned the repository, run the following inside the\nproject directory.\n\n```sh\ngit submodule update --init\n```\n\n\n### SMCKitTool\n\nA macOS command line tool for interfacing with the SMC using SMCKit. The\n[CommandLine](https://github.com/jatoben/CommandLine) library is used for\nthe CLI and [ronn](https://github.com/rtomayko/ronn) for generating the\n[manual page](https://beltex.github.io/SMCKit).\n\n##### Install\n\nThis will build SMCKitTool (`smckit(1)`) from source and place the binary and\nmanual page in your path.\n\n```\nmake install\n```\n\n##### Example\n\n```sh\n$ smckit\n-- Temperature --\nAMBIENT_AIR_0           34.0°C\nCPU_0_DIE               48.0°C\nCPU_0_PROXIMITY         39.0°C\nENCLOSURE_BASE_0        29.0°C\nENCLOSURE_BASE_1        29.0°C\nENCLOSURE_BASE_2        28.0°C\nHEATSINK_1              34.0°C\nMEM_SLOTS_PROXIMITY     36.0°C\nPALM_REST               27.0°C\n-- Fan --\n[id 0] Right Side\n    Min:      1299 RPM\n    Max:      6199 RPM\n    Current:  1292 RPM\n-- Power --\nAC Present:       true\nBattery Powered:  false\nCharging:         false\nBattery Ok:       true\nBattery Count:    1\n-- Misc --\nDisc in ODD:      false\n```\n\n\n### Library Usage Notes\n\n- The use of this library  will almost certainly not be allowed in the\n  Mac App Store as it is essentially using a private API\n- If you are creating a macOS command line tool, you cannot use SMCKit as a\n  library as Swift does not currently support static libraries. In such a\n  case, the `SMC.swift` file must simply be included in your project as another\n  source file. See\n  [SwiftInFlux/Runtime Dynamic Libraries](https://github.com/ksm/SwiftInFlux#runtime-dynamic-libraries)\n  for more information and both SMCKitTool \u0026\n  [dshb](https://github.com/beltex/dshb) as examples of such a case.\n\n\n### References\n\nThere are many projects that interface with the SMC for one purpose or another.\nCredit is most certainly due to them for the reference. Such projects as:\n\n- iStat Pro\n- [osx-cpu-temp](https://github.com/lavoiesl/osx-cpu-temp)\n- [PowerManagement](http://www.opensource.apple.com/source/PowerManagement/)\n- [powermetrics(1)](https://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man1/powermetrics.1.html)\n- [smcFanControl](https://github.com/hholtmann/smcFanControl)\n\nHandy I/O Kit references:\n\n- [iOS Hacker's Handbook](http://ca.wiley.com/WileyCDA/WileyTitle/productCd-1118204123.html)\n- [Mac OS X and iOS Internals: To the Apple's Core](http://ca.wiley.com/WileyCDA/WileyTitle/productCd-1118057651.html)\n- [OS X and iOS Kernel Programming](http://www.apress.com/apple-mac/objective-c/9781430235361)\n\n\n### License\n\nThis project is under the **MIT License**.\n\n\n### Fun\n\nWhile the SMC driver is closed source, the call strucutre and definition of\ncertain structs needed to interact with it (see `SMCParamStruct`) happened to\nappear in the open source Apple **PowerManagement** project at around version\n211, and soon after disappeared. They can be seen in the\n[PrivateLib.c](http://www.opensource.apple.com/source/PowerManagement/PowerManagement-211/pmconfigd/PrivateLib.c)\nfile under `pmconfigd`. In the very same source file, the following snippet can be\nfound:\n\n```c\n// And simply AppleSMC with kCFBooleanTrue to let them know time is changed.\n// We don't pass any information down.\nIORegistryEntrySetCFProperty( _smc,\n                    CFSTR(\"TheTimesAreAChangin\"),\n                    kCFBooleanTrue);\n```\n\nAlmost certainly a reference to Bob Dylan's\n\u003ca href=\"https://en.wikipedia.org/wiki/The_Times_They_Are_a-Changin%27_(song)\"\u003eThe Times They Are a-Changin'\u003c/a\u003e :)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figlance%2Fsmckit","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Figlance%2Fsmckit","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Figlance%2Fsmckit/lists"}