4

I have a Macbook Air, which can get hot when the core i5 inside ramps up (using Turbo Boost). I thought I'd make a geektool script to show me what speed the processor is currently at, and put it on my desktop. Unfortunately, it isn't as easy as finding the same information on my android phone.

Does anyone know a way to find the current processor speed through the shell (whether OSX specific or Unix/BSD, it may work here).

2
  • Actually there's no readymade CLI program available, but you can use an Intel API or measure the thermal throttling itself. See this similar apple stackexchange question: apple.stackexchange.com/questions/328965/… Aug 22 '20 at 8:29
  • sudo powermetrics shows the CPU frequency as described as I discovered just now... Aug 22 '20 at 9:12
7

You can use sysctl hw.cpufrequency. Its output is in Hz, e.g.:

hw.cpufrequency: 2660000000

hw.cpufrequency_min and hw.cpufrequency_max contain the minimum and maximum values, respectively.

6
  • How is it possible to do this any quicker on a mobile phone's command line? This is way more to type with more than 2.5x the number of characters.
    – Daniel Beck
    Jan 10 '12 at 19:19
  • I never said it was quicker--it was easier because I knew where it was.
    – semisight
    Jan 10 '12 at 21:45
  • @sem if that's the only reason it's really not. Maybe for you, specifically, but as you can see, a one-liner can change that pretty quickly. There's no value in that part of your question...
    – Daniel Beck
    Jan 10 '12 at 22:09
  • I mean, technically, there was no value to any part of my question except the question itself. It just feels so wrong to post one line questions... I do see your point. Sorry for the confusion.
    – semisight
    Jan 10 '12 at 23:15
  • 1
    This command only measure the nominal CPU frequency (without boost) and is independent of thermal throttling. See this related question: apple.stackexchange.com/questions/328965/… Aug 22 '20 at 8:30
6

sudo powermetrics shows many details on CPU frequency (with a system average and per code). It's an inbuilt system CLI utility:

System Average frequency as fraction of nominal: 119.17% (3098.45 Mhz)
[..]
CPU 0
[..]
CPU Average frequency as fraction of nominal: 119.18% (3098.67 Mhz)

CPU 1
[..]
CPU Average frequency as fraction of nominal: 119.07% (3095.79 Mhz)
[..]
1
  • Thanks! The sysctl command doesn't work on the new M1 Macs, but this powermetrics command works perfectly! It was amazing to confirm that my fanless M1 Air throttles way less when compiling an Xcode project than my maxed out i9 Pro when testing both plugged into my 5K LG monitor...which leads to much faster compile times while using a total of 15W!! The i9 throttles all the way down to 1.2GHz while the Air stays at around 2.5GHz on the perf cores and around 2GHz on the low power cores. Incredible! I imagine the M1 13" Pro doesn't even throttle at all given the fan, though I can't test myself.
    – Ben Baron
    Apr 23 at 15:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.