Stress test a Mac by maxing out CPU

If you want to completely peg CPU to stress test a Mac, turn no further than the Terminal. Using the command line you can easily max out all CPU cores and induce huge load on a Mac, making it easy to determine things like what temperature the processor reaches under heavy load, if fans are working properly, how loud fans get, what battery life is like under immense workload, and other technical aspects that can be helpful for troubleshooting purposes.

To max out the Mac CPU we’ll use the command line tool called “yes”, which basically does nothing except repeat the word “yes” at such speed that it consumes all available processor resources. Generally speaking, each instances of “yes” will max out a single thread on a single CPU core. This means if you have a dual core Mac with a hyperthreaded processor, you’ll need to have at least four different instances of “yes” running to put full load onto the CPU.

To begin, launch Terminal, and you may want to watch the UI-based task manager Activity Monitor so you can easily observe the CPU load and system resources.

When ready to stress test the Mac, type the following command:

yes > /dev/null &

That sends one instance of ‘yes’ into the background, but to load up the CPU you’ll want to have more than one running. Either repeat the process by hitting up arrow and return to run another several instances, or throw a group onto a single line like so:

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

You’ll quickly discover in Activity Monitor or top that the processor is getting hit hard.

When finished, in the same terminal window type “killall yes” into the command line to kill all instances of the yes command. You’ll see something like this:

$ killall yes
[1] Terminated: 15 yes > /dev/null
[2] Terminated: 15 yes > /dev/null
[3]- Terminated: 15 yes > /dev/null
[4]+ Terminated: 15 yes > /dev/null

You’ll also see all instances of “yes” drop from the process list in Activity Monitor. If not, there’s probably a typo in there somewhere.

Unless you have a valid reason to do this, you’re better off not randomly running “yes”, since it obviously causes performance issues until it stops running.

For some assistance, the video below demonstrates the entire process from start to finish:


Thanks to TJ for the tip idea

« »