Vous êtes sur la page 1sur 5

Stress Test a Mac by Maxing Out CPU

Home

Mac OS X

iPhone

http://osxdaily.com/2012/10/02/stress-test-mac-cpu/

iPad

Tips & Tricks

Jailbreak

News

iOS

Stress Test a Mac by Maxing Out CPU

Search

Subscribe to OSXDaily

Oct 2, 2012 - 9 Comments

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

Follow
@OSXDaily

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
its a technical process, its quite simple to do and well explain everything.

To max out the Mac CPU well 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, youll need
to have at least four dierent 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

1 of 5

11/19/14, 1:38 PM

Stress Test a Mac by Maxing Out CPU

http://osxdaily.com/2012/10/02/stress-test-mac-cpu/

the background, but to load up the CPU youll 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 &

Youll 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. Youll 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

Youll also see all instances of yes drop from the process list in Activity Monitor. If not, theres
probably a typo in there somewhere.
Unless you have a valid reason to do this, youre better o 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

Enjoy this tip? Subscribe to the OSXDaily newsletter to get more of


our great Apple tips, tricks, and important news delivered to your
inbox! Enter your email address below:

Subscribe

2 of 5

11/19/14, 1:38 PM

Stress Test a Mac by Maxing Out CPU

http://osxdaily.com/2012/10/02/stress-test-mac-cpu/

Related articles:
MemTest for Mac OS X Tests your RAM
Test Read & Write Speed of an External Drive or USB Flash Key
Test a website on an iPad
Test iPhone Signal Strength and Antenna Reception

Posted by: William Pearson in Command Line, Mac OS X, Tips & Tricks, Troubleshooting

9 Comments
Comments RSS Feed

Mathew says:
October 2, 2012 at 10:10 am

This could be used as a benchmarking tool of sorts couldnt it? If you somehow timed how long it
took to execute however many yeses? Just a thought.
Reply

jch says:
October 2, 2012 at 1:07 pm

No, not really. You can measure the ability of the OS to start processes, but its not a measure of
anything useful.
You also dont need yes for this: while :; do :; done & is slightly more CPU intensive and does
involve any system calls so it does nothing faster
Reply

Chris E says:
October 3, 2012 at 12:02 am

I saw this elsewhere sometime ago, and wondered then what kind of practical application this could
have. Its interesting in and of itself, but I dont see what real world use it actually has.
Reply

jch says:
October 3, 2012 at 2:08 pm

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.
Reply

3 of 5

11/19/14, 1:38 PM

Stress Test a Mac by Maxing Out CPU

http://osxdaily.com/2012/10/02/stress-test-mac-cpu/

Rob says:
April 20, 2014 at 7:50 pm

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.
Reply

Mel Alton says:


December 20, 2012 at 2:57 pm

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.
Reply

NA says:
March 13, 2013 at 1:15 pm

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
Reply

n/a says:
January 2, 2014 at 2:03 pm

This was fun to do on a mac pro 8-core. I maxed out all the cores
Reply

Brent says:
August 17, 2014 at 1:58 am

Well, it worked and it didnt. 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.
Reply

Leave a Reply
Name (required)

Mail (will not be published) (required)

Website

4 of 5

11/19/14, 1:38 PM

Stress Test a Mac by Maxing Out CPU

http://osxdaily.com/2012/10/02/stress-test-mac-cpu/

Submit Comment

Email Photos from iOS the Easy

How to Easily Tell If Someone

Way

Opened Your Files on a Mac

Shop for Apple & Mac Deals on Amazon.com

OS X Daily
Email us: osxdailycom@gmail.com
About OSXDaily | Contact Us | Privacy Policy | Sitemap
This website is unrelated to Apple Inc
All trademarks and copyrights on this website are property of their respective owners.

2014 OS X Daily. All Rights Reserved. Reproduction without explicit permission is prohibited.

5 of 5

11/19/14, 1:38 PM

Vous aimerez peut-être aussi