X Course Advisor FREE Course Advisor
Watch Tutorials
Optimise Your Mac's Performance: Using Terminal to Run OS X Maintenance Scripts

UNIX-based operating systems, like Mac OS X, are configured to run certain maintenance scripts automatically at certain times of the day. These scripts include daily, weekly, and monthly tasks, which include things like removing old log files, clearing out scratch and junk files, checking hard drives, and so on. These scripts are usually set to run between 4:00 and 5:00 AM, when presumably your system is not in use. However, if you shut your system down when you're not using it, as a conscientious energy-aware person should, those scripts won't ever get the chance to run. Eventually, all those dead old files and other junk will start to fill up your hard drive, and what's more, your system disk might begin to suffer performance issues. 

So what we're going to do here is lead you through running those scripts manually through Terminal, OS X' UNIX command line interface, while at the same time introducing you to what may be an unfamiliar and even daunting environment. But don't worry - it really isn't that scary, as long as you're careful.

Step 1 - Open Terminal

Terminal is located in your Utilities folder in the Applications, so navigate there and double-click it to launch it. You'll see a window like this (except with your computer name and user name instead of mine):

Step 2 - Enter the Script Command

Next, type the following text "sudo periodic all" (without the quotes), exactly as shown here:

Then hit Return. 

Step 3 - Enter Your Password

If this is first time you've done this, you'll see this rather dire warning:

But it's still OK, as long as you follow the instructions and enter the text entries exactly. Enter your password as requested (as a security measure, you won't actually see any text when you type) and hit Return again. And that's it. You also won't see anything in the Terminal to indicate progress or the completion of the tasks, except that when they're all done, you'll see the prompt after your name again. 

You can modify the command to run just one or more of the daily, weekly or monthly scripts by typing daily weekly or monthly either alone or separated by spaces instead of all in the command line. When you're done, just quit out of Terminal, and, to be safe, restart your system.

Or, if you find all this a little too frightening or deep, you can instead download any number of free apps, such as OnyX that give you a graphic user interface for running the scripts, and a lot more. But now you know the basics of using Terminal, at least. That wasn't so bad, was it?

Richard Lainhart

Richard Lainhart | Articles by this author

Richard Lainhart is an award-winning composer, filmmaker, and author. His compositions have been performed in the US, Europe Asia, and Australia, and recordings of his music have appeared on the Periodic Music, Vacant Lot, XI Records, Airglow Music, Tobira Records, Infrequency, VICMOD, and ExOvo labels. His animations and short films have been shown in festivals in the US, Europe, and Asia, and online at ResFest, The New Venue, The Bitscreen, and Streaming Cinema 2.0. He has authored over a dozen technical manuals for music and video hardware and software, served as Contributing Editor for Interactivity and 3D Design Magazines, and contributed to books on digital media production published by IDG, Peachpit Press, McGraw Hill, and Miller Freeman Books. Previously an Adobe Certified Expert in After Effects and Premiere, a demo artist for Adobe Systems, and co-founder of the official New York City After Effects User Group, he was, from 2000-2009, Technical Director for Total Training Productions, an innovative digital media training company based in New York and California.


May 17, 2011
No, it wasn't daunting in the least.
Actually I was hoping for a lot more! I didn't know that tip though, thanks.
May 17, 2011
Hi Will,

So are you interested in even more advanced Mac OSX Tips? What type of tips would you be looking to learn?

May 22, 2011
Hamish H
Hi Richard

Thanks very much for the tip. I tried this today, and it only took about .4 of a second before the original prompt came back. Is the process usually that fast?


Jun 14, 2011
Gary Hiebner
When I typed sudo periodic all.

I got the following error message:

No output from the 0 files processed
Macbook:~ matchbox$ sudo periodic all

If this happens you can run them by typing:

sudo periodic daily weekly monthly.

Then press return
You must be logged in to post a comment.
Create an Account  Login Now

What is macProVideo.com?

macProVideo.com is an online education community featuring Tutorial-Videos & Training for popular Audio & Video Applications including Adobe CS, Logic Studio, Final Cut Studio, and more.
© 2018 macProVideo.com
a division of NonLinear Educating Inc.