Mac Terminal

So I was typing some things in Terminal and after a while, I decided to use (sudo powermetrics --samplers smc |grep -i “CPU die temperature") to check CPU temperature but I was greeted with (pipe dquote>). Now would anyone know how to exit this? I already tried looking it up but it isn't helping. Any help is appreciated!

MacBook Pro 13″, macOS 10.15

Posted on Aug 30, 2022 6:13 AM

Reply
Question marked as Top-ranking reply

Posted on Aug 30, 2022 8:24 AM

In the Terminal, just type control+c to break out of the command expecting you to complete its syntax. Don't type control+z as that just throws the session in the background.


For Intel platforms only (notice the spacing around the pipe symbol).


sudo powermetrics -n 1 --samplers smc | grep "(CPU|GPU) die"

This was from a just booted Core i7 iMac:




21 replies
Question marked as Top-ranking reply

Aug 30, 2022 8:24 AM in response to LegionScyther7

In the Terminal, just type control+c to break out of the command expecting you to complete its syntax. Don't type control+z as that just throws the session in the background.


For Intel platforms only (notice the spacing around the pipe symbol).


sudo powermetrics -n 1 --samplers smc | grep "(CPU|GPU) die"

This was from a just booted Core i7 iMac:




Aug 30, 2022 8:57 AM in response to VikingOSX

Yeah... I think I did control+z earlier but I can't recall. Besides that, I did the control+c and it seemed to work but then I put it the (sudo powermetrics --samplers smc |grep -i “CPU die temperature") but it just shows (pipe dquote>) again. Would a restart help or no? Also, in case this info helps, this is on an Early 2015 13" MacBook Pro with an Intel Core i5. Anything else I could try?

Sep 12, 2022 6:08 AM in response to VikingOSX

So what could I do from here? I really only use the sudo powermetrics --samplers smc |grep -i “CPU die temperature" command to check my CPU temperature when playing games or when I'm using CPU intensive software. That command worked everytime until pipe dquote kept appearing after entering sudo powermetrics --samplers smc |grep -i “CPU die temperature".

Sep 12, 2022 9:43 AM in response to LegionScyther7

FYI, I managed to try this command on several different models of Apple laptops with varying results. It seems many laptops don't access to the temps or SMC attributes. The laptops I've been able to retrieve the SMC values have been the USB-C 2016+ models. On some older laptops it is telling me it cannot retrieve SMC values because "SMC is currently in monitor mode". I'm not sure what is going on with that error message. If you use this part of the command without adding the "grep" filter, then you will see the information provided and any error messages:

sudo  powermetrics  -n1  --samplers  smc


The command provided by @VikingOSX is incorrect as it cannot parse the "(CPU|GPU)" portion of the filter. The following updated command will work if the SMC values are accessible (notice the inclusion of the "-E" option necessary for the "(CPU|GPU)" portion of the filter to work -- tested on Big Sur):

sudo  powermetrics  -n1  --samplers  smc  |   grep  -iE  "(CPU|GPU) die"



Of course this all assumes you are using an Intel Mac since M1/M2 Macs with Apple Silicon do not have an SMC so these command will not work at all. I have no idea how to access any sensor information on Apple Silicon Macs or possible alternate methods on the Intel Macs. I normally just rely on third party apps like MacsFanControl to provide the functionality, although I may be looking into an app which can produce a sensor log over time (I don't usually need this functionality, but there are times it may prove useful).

Sep 12, 2022 10:12 AM in response to HWTech

HWTech wrote:

The command provided by @VikingOSX is incorrect as it cannot parse the "(CPU|GPU)" portion of the filter.


It was correct on my particular 2020 Intel Core i7 hardware as the screen capture was the command and its results without using the extended (-E) grep. But as you have observed, powermetrics does behave differently across varying Mac hardware, so one might have to use egrep where appropriate.

Sep 12, 2022 12:31 PM in response to VikingOSX

VikingOSX wrote:


HWTech wrote:

The command provided by @VikingOSX is incorrect as it cannot parse the "(CPU|GPU)" portion of the filter.

It was correct on my particular 2020 Intel Core i7 hardware as the screen capture was the command and its results without using the extended (-E) grep.

Just curious what version of macOS you are using? I was using multiple versions of Big Sur from early 11.6.1 to latest 11.6.8 on at least two different laptop models 2014 & 2017.


HWTech wrote:

On some older laptops it is telling me it cannot retrieve SMC values because "SMC is currently in monitor mode".

Seems a reboot fixed this issue. Now I have to wonder if this is related to the issue a user reported for the laptop running hot. I really miss the days when Macs acted normal and didn't have so many quirks. Hard to tell what is normal and abnormal these days.

Sep 14, 2022 1:54 PM in response to HWTech

I entered the sudo powermetrics -n1 --samplers smc command and got (SMC is currently in monitor mode, no data available). However, when I entered it a second time, I got what's in the first image. Now for the sudo  powermetrics  -n1  --samplers  smc  |   grep  -iE  "(CPU|GPU) die" command, I entered my password and it gave the CPU temperature once. It only gives the temperature if the CPU is being used enough or else it won't show. The second image shows this. The highlighted part is when the CPU was cool giving no info while the non-highlighted part is when the CPU reached a high temperature.

Sep 16, 2022 5:02 PM in response to LegionScyther7

If you want to monitor the temperature non-stop, then remove the " -n1" part of the command as that limits it to one time reporting. To terminate the command you will need to press Control + C within that Terminal window running the process.


FYI, I was hoping to test this command on a Mac running Monterey to compare my results with Big Sur and @VikingOSX. I'll see if I can remember next week. Unfortunately Apple has been making changes to the hardware and even these utilities so things don't always work as expected across various hardware and OS revisions. Somehow third party apps are able to access the temperature sensors, but I'm not sure how they do it. I'm not sure if there is anyway to do so using standard macOS command line utilities.


Personally I normally just use MacsFanControl (posted link in earlier post) to monitor the fan speed and temps since it just works. I have rarely needed to worry about logging the results. It is possible to run MacsFanControl without installing the driver as long as you don't authenticate when running the app, but it is a bit non-intuitive to do so as you must also "Cancel" one of the options. I normally just run it directly from the Downloads folder. Plus this option may prevent being able to automatically update the app. Unfortunately you cannot log the results with this method.

Sep 20, 2022 7:39 AM in response to HWTech

So I did what you said and it works! It gives the temperature just like before! I noticed that both sudo  powermetrics  --samplers  smc  |  grep  -iE  "(CPU|GPU) die" and sudo  powermetrics  --samplers  smc  |  grep  -iE  "(CPU) die" give CPU temp but I think (I think) that pipe dquote only appears when an invalid command is entered? I don't know for sure but it's worth mentioning...

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Mac Terminal

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.