All Articles Mac OSX
Optimise Your Mac's Performance: Using Terminal to Run OS X Maintenance Scripts
Richard Lainhart on Mon, May 16th 4 comments
Optimise Your Mac's Performance: Using Terminal to Run OS X Maintenance Scripts So what we're going to do here is lead you through running those scripts manually through Terminal, OS X' UNIX command l

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?

Related Videos
Comments (4)

You must be logged in to comment.

  • Tecepue
    No, it wasn't daunting in the least. Actually I was hoping for a lot more! I didn't know that tip though, thanks.
    • 10 years ago
    • By: Tecepue
  • Rounik Admin
    Hi Will, So are you interested in even more advanced Mac OSX Tips? What type of tips would you be looking to learn? Thanks
    • 10 years ago
    • By: Rounik Admin
  • 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? Thanks! Hamish
    • 10 years ago
    • By: Hamish H
  • GaryHiebner
    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
    • 10 years ago
    • By: GaryHiebner
Recording and Editing
Cubase 11 102
Dream It. Do It.
Do you want to learn Recording and Editing?
Yes, I want to learn!
No Thanks, I just want to read the article.
Course Advisor
Don't Know Where To Start?
Ask A Course Advisor
Ask Us!
Copy the link below and paste it into an email, forum, or Facebook to share this with your friends.
Make money when you share our links
Become a Affiliate!
The current affiliate rate is: 50%
Classes Start Next Week!
Live 8-week Online Certification Classes for: