When it comes to diagnosing hardware issues on Apple hardware, sometimes they can be difficult to track down. Especially when the issue only occurs when the Mac is under load.
However, there is a unix command you can use to stress test the CPU from the OS’s Terminal. Although you’re not lightly to find it without knowing it’s there.
The utility called “Yes” is a simple application, which you call from Terminal. Upon executing the command in Terminal your CPU will rapidly race up to 100%
To initiate the test, launch a Terminal window, type the following command and press return:
As soon as the command commences, you will see your terminal window filling with Y’s, this is how it stresses your CPU. Once you are done testing, you can cancel the stress test using Ctrl + C.
The Yes unix app accepts any character or numeric value as a parameter, and outputs it repeatedly into the Terminal window. For example, if you open a terminal window and type:
The command will output 4321 repeatedly until stopped. So to really test your CPU you could pass:
Some Mac’s have been known to suffer with an issue causing them to shutdown after 15 minutes of intensive CPU usage. Should you find your Mac does this when under load using Yes, you may want to get in touch with Apple Tech support.
It can also be used to pipe the parameter to another application, therefore forcing an app which normally requires interaction to run no-interactively. Which makes Yes both a very powerful, and a very dangerous tool.
For example, should you want to delete all the files in the current folder without responding to each prompt you could use this following command:
YES | RM *.* <- Do not copy/paste this into terminal
The RM command would immediately start removing files of any extension in the directory, using the Yes commands output as confirmation of the delete.
So – as you can imagine, this could be a very dangerous command used in the incorrect way. However, it is a goto command used by the Genius’ bar in Apple stores.