Terminal 101: Stress Test Your Mac With the Yes Command

Every Monday, we'll show you how to do something new and simple with Apple's built-in command line application. You don't need any fancy software, or a knowledge of coding to do any of these. All you need is a keyboard to type 'em out!

If you've ever had an issue with your Mac that only happened when the computer was under stress (or if you just have the sudden urge to give your Mac a stress test), then there's a Terminal command for you. Apple technicians often use the "yes" command to instantly begin utilizing 100 percent of your CPU and its cores. This is great for when you need to burn in or stress a Mac (or other Unix machine). Let's take a look at how to use it.

Echoing y

By default, you can type the word "yes" into the command line, followed by enter to begin continually printing "y" to the standard out.

Echoing another word

If you're running this test on a lot of machines, and get bored by the continual string of "y" running across the screen, then you can make things more exciting by denoting your own custom string to use. To do this, type the following command into the terminal:

yes [word]

Replace "[word]" with the word that you wish to echo to the command line.

Stopping the command

To stop the "yes" command from running, and relieve the strain on your Mac, you'll navigate back to the Terminal window and press the Control + C keyboard combo.

Maxing all cores

If you have a multi-core machine, then you enter the following command, followed by a space, the "&" sign, and the exact same command to match the number of cores your machine has:

yes > /dev/null

So, if you have two cores, use the following command:

if you have three cores, this command:

and so on until you max out each core on your Mac.

To end this test and relieve the strain on your Mac, use the Control + C command, but then type the following command:

killall yes

This will ensure that all of the "yes" processes that were spawned on your computer are properly killed off and no longer continue to run. Using this method, the Terminal will not output any words to the screen.

Cory Bohon is a freelance technology writer, indie Mac and iOS developer, and amateur photographer. Follow this article's author on Twitter.