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. Though it’s a technical process, it’s quite simple to do and we’ll explain everything.
How to Stress Test a Mac
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:
For those wondering, this works in all versions of Mac OS X and even linux as well, so you can stress test any Mac ever made this way. In fact, as long as there is a command line that is unix based, you could run the ‘yes’ command to stress test a Mac CPU by using this approach.
Be sure you quit and kill the ‘yes’ commands when finished stress testing the Mac, as otherwise the CPU usage will remain high and the fans will undoubtedly go on full speed shortly.
Works like a charm, use it to drive out all the ants trying to hibernate in my mac
I just used this to drain the battery of my van. Cause i wanted to simulate the most power the latop could take, and how long ;P cheers
You can use Prime95. It’s used by Windows guys to stress test their CPUs but is also available for Mac. The program is designed as a collaborative effort to find prime numbers but can also be used to stress test the CPU. I used it for my Windows PC, and was glad it was also available for OSX. The CPU shows the running process using 350% percent CPU (wtf) and it’s working the fans hard.
Thanks a lot man, having a shoddy mac at the moment from start 2012 – so it’s under pressure quickly. ;)
I extended this idea to warm up my MacBook Air in the winter. I use the following script, saved as cpu.command. It automatically checks fan speed, and the script turns itself off when the fan reaches that speed.
#!/bin/bash
yes > /dev/null &
yes > /dev/null &
yes > /dev/null &
yes > /dev/null &
cpu=0
io=0
while [ $io -lt 25 ]
do
echo $cpu $io
read _ cpu < <(sysctl machdep.xcpm.cpu_thermal_level)
read _ io < <(sysctl machdep.xcpm.io_thermal_level)
sleep 10
done
killall yes
exit;
Correction to my previous post, I meant the memory test for chips, not the stress test. If my comment could be posted in the proper web page, thank you.
Tried installing on my 2010 iMac and got a warning that the version of the test was incompatible with my system ( Now using El Capitan)and might damage my susytem, create a void in space, and cause Trump to win. Will look for a newer version
This is the best thing I have ever seen, it’s useful and an easy way to stress test a Mac processor. Thanks!
did you know that if you want to see how many yesses are being produced you can just type the command: yes and terminal will fill up with the letter y,
but if you don’t want it to continuously say:
y
y
y
y
just enter yes then before pressing enter type in the word you want to fill terminal with
This doesn’t make computer “struggling” though because it distributes the load to fit 100% CPU. Sometimes you need to see what happens if computer is really suffering and has to deal with overload.
It has a practical application. I am stuck at ORD airport overnight. I have no luggage. I only have a T-shirt. It’s freezing. I used this to turn my Macbook into a heater and I’ve been cuddling it all night. A lifesaver.
*THANKS!!*
That’s horrifying. Did your macbook really not run out of battery?
He is just joking. :D
this doesn’t really test the performance of the system due to the process you are opening not requiring a lot of power. try doing something like, opening 64 world of warcraft. i have seen many systems on a slightly lower spec for half the price perform well doing this. if your feeling adventurous then go for a very cpu intensive game like arma 2 days mod. that will show the true potential of the mac.
Thought to test a new (unopened, in box) Late 2012 MINI
quad-core 2.3GHz server prior to fully accepting it, since
there still is time to send back this ‘clearance’ item bought
direct from Apple online. Not sure if I’d use it as Server, &
could not get an exacting answer from Apple (store, main
support, or other; by phone from AK) & so don’t trust it
to be able to run the system I hope was shipped in it.
Since there is little opportunity to tell, & they aren’t saying
it was the desire to NOT run Yosemite, and to be able to
upgrade RAM (to 16GB) and later add SSD/HDD upgrade
is why I initially chose this. It has two 1-TB HDDs.
Apple could not tell me the OS X version it shipped with.
I was closer to knowing by use of online Lookup service
of the serial number (from invoice) than their Experts.
Anyway, I have a week to ship it back or to to their only
Store in my state to hand it over (for re-credit to card.)
I could not get a rise out of the Store staff, the only time
I was there and walked through slow. Figure I must have
caught them in a Zen moment, meditating on iDevices,
as they were looking into touch-pad/screen products &
never did look up. If I had an iPhone, I’d have called them
while standing in the Store, to see if anyone looked up.
A surprise, for my first time in an Apple Store, yet I’ve
owned over 300 Macs, most second hand; repaired and
donated almost all of them in restored condition. You
almost can’t do that now in newest w/ soldered parts…!
Thank you for your consideration & a reply…
~in a small town…
kenai mts, alaska
Well, it worked and it didn’t. Heh. It maxed out all the cores, but even after 10 minutes, it did not rev up the fans any more than a teency bit beyond normal.
My computer has a fluttery fan and I was trying to see if revving them up might A. Fix it or B. Tell me which one is the culprit.
This was fun to do on a mac pro 8-core. I maxed out all the cores
I just tested my macbook pro retina. Worked as stated just wanted to warm the CPU up after spilling small amount of tea on the keyboard! biggest yikes moment of my life, never drink next to a laptop… especially a macbook worth around £2000
Thanks, this is really useful for testing out your cpu heatsink and cooler. Start one yes process per core (including hyperthreads) and use something like the Temperature Monitor app to see how hot the cpu gets over time.
I have a hackintosh built with an i7-3770 and an aftermarket cooler, and I wanted to see how it performed. The i7-3770 has 4 cores and 4 hyperthreads, so I fired up 7 yes processes, then started the activity monitor to watch the cpu usage (88%, since I also had browsers open) and used Temperature Monitor to see how the cooler did.
I saw this elsewhere sometime ago, and wondered then what kind of practical application this could have. It’s interesting in and of itself, but I don’t see what real world use it actually has.
Before fsck got its “-y” option, “yes | fsck” was often a good idea. There are other programs that have similar prompting behaviour.
Oh, and “yes no | fsck” might sometimes be a good idea.
I think yes dates back to Unix Edition 6. There are lots of programs that have little use by themselves but are designed specifically to be combined with something else. Unix is Lego for computers.
I did this at University, I wrote a command that spawned itself twice. I managed to bring down one of the main University servers before I had a chance to stop it.
Software developers can use this to try to reproduce bugs that only occur under load.
No, not really. You can measure the ability of the OS to start processes, but its not a measure of anything useful.
You also don’t need yes for this: “while :; do :; done &” is slightly more CPU intensive and does involve any system calls so it does nothing faster :)
This could be used as a benchmarking tool of sorts couldn’t it? If you somehow timed how long it took to execute however many yeses? Just a thought.