Stress Test Your Mac and CPU 1

Terminal

Share
Stress Test Your Mac and CPU

Hey

When you have a new or old Mac, every so often you will want to stress test your Mac to see if it has any problems or it can handle the heat. There are a variety of different ways in which you can do this, however one of the simplest ways is to use Terminal. This guide will show you how to set your CPU running at max speed, which you can tailor to the number of CPU’s cores you have. Then its just a matter of watching the results in Activity Monitor, watch for stability issues and see the temperature of your Mac rise.

The first step is to open Activity Monitor located in Applications > Utilities folder. Set the entries in the list view to be ordered by CPU %, so you can see what is using your computer. Then, if required, install an app to monitor the temperature of your Mac. I recommend iStat, either the dashboard or menu bar app, however Temperature Monitor, is also a good app if it is slightly more technical.

After you have opened your monitoring software we can now stress your CPU. Open Terminal. As a starter type the following into Terminal:

yes

You will notice, Terminal starts outputting the letter ‘y’ and the CPU of your Mac increasing. The yes command, will keep repeating this command indefinitely. To stop the process either press Control + C on your keyboard or close the Terminal window.

We can now use this command for each CPU (physical) core we have on your Mac. End the previous command, and type the following instead:

yes > /dev/null

This will output the results of yes to a special location on your mac called /dev/null . This is done because opening up multiple instances of the yes command will not increase the load on your computer past 100%. However, when we pipe this command to /dev/null it will.

If you notice in Activity monitor your CPU load will increase to 100% of the yes command. This is fully loading one CPU core to its maximum. If you use something like iStat, you will notice the load is spread evenly between each cores, a feature of your operating system. To load the other cores, open up a new Terminal window, keeping the first one open, and repeat the command.

When you open two instances of the yes command being piped to /dev/null your load will increase to 200%, keep doing this for each core you have.

Activity Monitor under heavy load.

One of the new features of the Intel cores is the ability to have hyper-threading, as a result your Mac will report more cores than is physically present. This means if you have a quad core processor, your Mac will report eight cores. It allows your computer to run faster. However, in this stress test you will never be able to stress those extra four virtual cores. It doesn’t really matter, but means your CPU monitor will only fill half way, when in reality every core is running at full speed. It also means your the yes command can run at 100% (for each core) and other tasks can compute at the same time.

When you have finally finished stress testing your Mac, either close the Terminal window, of press Control + C. I let the command run for a couple of minutes and watched the CPU temperature slowly rise. If you think you have a problem with your CPU running at full speed, running this command and carrying out normal running of your Mac at the same time will help you eliminate any possible problems.

If you have any questions or comments, please leave one using the form below.


If you want to keep up with the latests post from Mac Tricks And Tips I recommend you subscribe to the RSS Feed.

Where To Next?

  • Subscribe To Mac Tricks And Tips