2

How to Stress Test a Mac CPU

Posted by Jim Tanous on July 1, 2015
stress test mac

Stress testing a computer is an important troubleshooting step that can help users determine if newly upgraded parts are working properly, or identify system stability issues. While stress testing is most common in the PC overclocking world, Mac owners can also use stress testing for a number of reasons, including identifying overheating issues, testing battery capacity under load, determining CPU throttling limits, or simply to see how loud a Mac’s fan can get at full speed.
There are a variety of utilities available that offer stress testing capabilities — examples include Geekbench, CPUTest, and NovaBench —  but if you just want to test your CPU, you can do so directly from Terminal without any third party software.
To stress test a Mac’s CPU, we can use the “yes” command, a Unix command that, without modification, will simply output an affirmative response (‘y’) over and over again until it is terminated. To stress test a Mac with the “yes” command, open Terminal, type the following, and press Return to execute:

yes > /dev/null &

stress test mac single
After a moment, you’ll see the number 1 in brackets appear next to a (likely) 3- or 4-digit number. This indicates that the “yes” command is maxing out one thread of your Mac CPU (the [1]), with the designated Process ID (the 3- or 4-digit number). You can verify this and see the CPU activity via the Activity Monitor application (located in Applications > Utilities).
The problem, however, is that unless your Mac is more than 10 years old, it almost certainly has a CPU with multiple cores and threads, and running the command above only tests one of those threads. To truly stress test a Mac, you’ll need to max out all threads of your CPU, which you can do by repeating the command above.
For example, we have a 2013 6-core Mac Pro in our office here at TekRevue. That 6-core processor — a Xeon E5-1650 v2, if you’re interested — is also hyper-threaded, meaning that we have a total of 12 CPU threads at our disposal. To test all 12 logical cores, we would replicate the “yes” command listed above 12 times. You can do this by opening a new Terminal window for each command, or by combining them into a single command like this:

yes > /dev/null & yes > /dev/null & yes > /dev/null & yes > /dev/null & yes > /dev/null & yes > /dev/null & yes > /dev/null & yes > /dev/null & yes > /dev/null & yes > /dev/null & yes > /dev/null & yes > /dev/null &

stress test mac cpu yes
To modify this command for your own Mac, simply adjust the number of times that yes > /dev/null & repeats based on your Mac’s total CPU threads. For example, the new 12-inch Retina MacBook has a dual-core hyper-threaded CPU, meaning that you would use only 4 instances of the “yes” command. If you’re unsure about your Mac’s CPU configuration, a great place to check is EveryMac, a database that contains the details — you guessed it — for every Mac, including the number of processors and cores.
While properly functioning Macs should have no trouble with a stress test, it’s important to note that if your Mac has a hardware or cooling issue a CPU stress test can crash the system. Therefore, make sure you save any important documents and close your applications before running the test to ensure that you won’t lose any data if your Mac unexpectedly shuts down or crashes.
Once you’ve let the test run for a few hours (or overnight if you really want to push your Mac to the limit), you can end the test by closing the Terminal window(s) containing the “yes” command. You can then verify in Activity Monitor that your Mac CPU is no longer maxed out.
A final note: stress testing a Mac’s CPU will increase the heat generated by a significant amount. Before stress testing, make sure your Mac is in a relatively cool and well ventilated area, and that the Mac’s fan or airflow ports are unobstructed. While Intel CPUs will automatically throttle or shut down if temperatures get too high, there is still a chance that you can permanently damage your Mac if you max out the processor without proper ventilation or heat dissipation.

2 thoughts on “How to Stress Test a Mac CPU”

hackerb9 says:
While this is a useful article, there is a minor error. The number 1 in brackets (the [1]) does *not* indicate that the “yes” command is maxing out one thread of your Mac CPU. That is simply the UNIX way of naming background processes so that you can refer to them again later (e.g., `fg %1` will put job #1 in the foreground). As a counter example, the command `sleep 60 &` will also show [1], but it is not taking up any CPU at all.
Reply
csience says:
Great writeup with awesome examples!
Reply

Leave a Reply

Your email address will not be published. Required fields are marked *


Disclaimer: Some pages on this site may include an affiliate link. This does not effect our editorial in any way.