This is an unofficial mirror of pondini.org by James Pond, who is unfortunately no longer with us.

All rights belong to James' beneficiaries.

No guarantee is made about the accuracy or completeness of this mirror.

 

Apple Tips

OSX  Maintenance  Scripts

                  Previous                         Home                           Contact                             Next

 

                 Previous                         Home                        Contact                            Next

Your Mac runs three periodic "maintenance scripts" in the early morning hours, if possible, between the hours of  3:15 am and 5:00 am, local time.

Here's what they are, and some of what they do:

  1. Daily: deletes some temporary files, etc., and records various statistics.  On older versions of OSX, some log files are "rotated," but in newer versions that's been moved to another process.  See the blue box below.

  2. Weekly:  rebuilds some system databases.

  3. Monthly:  rotates some minor log files, records user statistics.

(For details, if you're familiar with UNIX, see the man page for periodic.conf.)

If your Mac is awake between 3:15 am and 5:00 am, the scripts will run automatically.

On Snow Leopard 10.6.x and later, if your Mac is powered-on but sleeping during those hours, the scripts will run shortly after it wakes.

On Leopard or earlier, If your Mac is powered off or sleeping, the scripts will not run.

(If you're not sure what version of OSX you're running, click here).

It's rarely a problem if these scripts don't run exactly as scheduled.  But if they don't run for an extended time, a bit of extra space may be used on your OSX volume.  This can be magnified if there are other problems, especially any that cause many messages to be sent to your logs.  On occasion, users have had many GBs of space taken up by such files.

To see when they last ran, use the Console app, per the tan box in  OSX Log Files.  You'll find the logs in the sidebar, named daily.out, weekly.out, and monthly.out.  Each will document the date and time, and some of what they've done.

The best way to be sure they run is to let your Mac sleep unless it won't be used for a few days.  See  Sleeping your Mac vs. Powering it Down  for details.

There are some 3rd-party apps that can run the scripts, or you can do it yourself, via the Terminal app (in your Applications/Utilities folder.)

Be extremely careful when using Terminal.  It is a direct command-line interface into UNIX, the underpinning of OSX.  Unlike the Finder, there are few protections against making a mistake, which can cause untold damage.

In Terminal, the prompt looks like this:   <Computer Name>:~ <your name>$

(where <your name> is your short user name).  It's followed by a non-blinking block cursor.

At the prompt, type or copy:  sudo periodic all   and press Return.

(or replace all with one or more of  daily weekly  or monthly  separated by spaces.)

You'll be prompted for your Admin password (which won't be displayed).  Press Return again.

When it's done, you'll see the prompt again (there's no confirmation message).

Log Files

Several logs (and some others) are normally "rotated" (#7 deleted, the others incremented, the current system.log compressed into system.log.0.bz2, and a new system.log created) by the newsyslog process that runs at 12:30 am local time.  If your system.log covers many days, just leave your Mac awake at that hour occasionally so they'll get rotated.

  1. If you're comfortable with UNIX and Terminal: 

  2. The schedule and handling can be altered.  See the MAN pages for newsyslog and newsyslog.conf.  Alterations may have to be re-done after OSX upgrades.

  3. You can rotate them immediately.  Copy and paste this after a Terminal prompt: 

  4. sudo newsyslog -F /var/log/system.log 

  5. (You'll be prompted for your Admin password, which won't be displayed.)