Closed davidaramant closed 1 year ago
I can see that on my old Intel Mac the name does include "@ 2.30GHz" at the end. This is not present on the M1.
Rather than parsing brand_string
, the appropriate id to use appears to be hw.cpufrequency_max
. Unfortunately on an M1 this does not return a value. From what I've found online, similar projects to this one either return 0 or hardcode a frequency for M1 CPUs since there is currently no way to read it using sysctl
. I think simply returning 0 is more appropriate, since not returning a value may be a bug that Apple fixes at some point.
I am going to submit a pull request that trims the brand_string
to remove the clock speed as well as using hw.cpufrequency_max
instead for that value.
Thank you very much for taking the time to update the code to include the new M1 and to verify it on the Intel. I really appreciate it!
Here is the new version: https://github.com/Jinjinov/Hardware.Info/releases/tag/v10.1.0.1
Glad to help!
Library version
10.1.0
OS & OS version
macOS 13.0.1
Describe the bug
The CPU name along with some other properties like the clockspeed are empty.
To Reproduce
Run the test project on an M1 Mac.
Since I happen to have one of these (an M1 Max) I will look into submitting a fix for this. I tried manually running the command to look up the CPU and it returns the string "Apple M1 Max" but it looks like the code is assuming an @ character be present. I'll have to investigate if there are other
sysctl
arguments. I have an old Intel Mac mini I can set up to make sure I don't break the Intel CPU info.