Home

 › 

Articles

 › 

How-to

 › 

How to Run Maintenance Scripts on Mac: Two Simple Methods

How to run maintenance scripts on mac

How to Run Maintenance Scripts on Mac: Two Simple Methods

Maintenance scripts on Mac are part of your system’s self-optimizing design. Ever since 2016, when Apple released macOS High Sierra, we have enjoyed the self-cleaning utility known as maintenance scripts.

These scripts are responsible for clearing out temp files, network statistics, twin downloads, and Apple-related cache files. Your Mac will run significantly better when maintenance scripts have a chance to run. Luckily, macOS handles this automatically – most of the time.

However, if maintenance scripts fail to perform as expected, it can be helpful to take matters into your own hands. There are two simple ways to do this, which we’ll go over in this blog. Let’s get started!

Run Maintenance Scripts on Mac via Terminal

Your Mac is designed to run maintenance scripts automatically. Typically, these scripts are programmed to run between 3 and 5 am every day. But as you can imagine, you’ll miss out if your Mac is off during these hours. Unless you’re using your computer at the time, or just leaving it on overnight, you’ll continually miss these maintenance tasks.

The next best thing is to run maintenance scripts yourself. It is relatively easy to do this manually. All you need is this guide and about two minutes of your time. Let’s break down the steps.

Step 1: Open Terminal

First, open up Finder and go to the Applications folder.

Inside the Applications folder, find the Utilities folder and open it.

Look for an app called Terminal and launch it.

Locate Terminal in your Applications folder.

©History-Computer.com

Step 2: Enter Maintenance Script Command

Once Terminal is up and running, you’ll see a command line interface.

Type in the following command exactly: “sudo periodic daily weekly monthly” (without the quotes).

After typing the command, simply hit the Return key on your keyboard.

Enter the command sudo periodic daily weekly monthly

©History-Computer.com

Step 3: Enter Your Password

Right after typing the command, you might see a prompt asking for your password.

Type in your Admin password (don’t worry if you don’t see any characters while typing) and hit Return.

Now, just sit back and let the scripts do their thing. Wait patiently until the scripts finish running and you see the Terminal ready for your next command.

Run Maintenance Scripts via a Third-Party Application

If using the Terminal makes you a little nervous, or you aren’t comfortable typing commands, you can still run maintenance scripts. Many apps claim to offer “one-click optimization” and similar promises. But the important thing is to avoid unnecessary or bloated software.

Running maintenance scripts on Mac won’t require a heavy app, or an expensive solution. It’s a fairly basic set of operations. So, finding a free program to handle everything for you should be no problem.

Step 1: Download the Application

One such application that makes running maintenance scripts easy, is CleanMyMac X. While they offer a free and paid version, the free model is enough to run maintenance scripts. Another popular app for running maintenance scripts is called Onyx, but we’ll perform these steps with CleanMyMac X instead.

Download and install CleanMyMac X. Once you have it on your computer, launch the app.

Launch the app and select Maintenance from the left sidebar.

©History-Computer.com

Step 2: Launch the App and Select Options

Locate Maintenance from the options on the left sidebar. Click it and select Maintenance Scripts from the available options. Finally, hit Run, and the app will take care of the rest.

run maintenance scripts on mac- hit run
Select Run Maintenance Scripts and hit Run.

©History-Computer.com

Here’s a video walkthrough of how to run maintenance scripts using a third-party app:

Should You Run Maintenance Scripts?

For context, these scripts aim to clean things up, like temp files, that might pile up over time. They also monitor and log the system status and contribute to the creation and maintenance of various parts of the system.

Interestingly enough, most of these scripts are a bit outdated, tending to relate to components that aren’t heavily used or even exist in contemporary versions of macOS. There’s an exception though; the script called /etc/periodic/daily/110.clean-tmps is still quite relevant as it’s responsible for cleaning up temporary files.

What happens is these scripts are a bit of a legacy system from when macOS, back when it was called Mac OS X, inherited its system from FreeBSD. In today’s versions of macOS, Apple tends to approach cleanup and maintenance in a slightly different manner, leaving these scripts somewhat redundant.

Each script loads settings from /etc/defaults/periodic.conf, plus /etc/periodic.conf and /etc/periodic.conf.local, which don’t typically exist by default.

So, what about the daily scripts?

Well, they do various tasks from deleting old files in /tmp, removing old “system messages”, to checking local disk space and network interfaces. Some of them also manage functions that are barely used today, like the msgs and ac commands.

What about weekly scripts?

There used to be a script, 320.whatis, that created and updated a database for man pages. However, it’s gone missing sometime between different macOS versions. Now, there’s just the 999.local script that runs /etc/weekly.local if it exists for backward compatibility purposes.

And finally, the monthly scripts?

They rotate old fax logs, deal with the system accounting system that’s almost never used, and, like its daily and weekly counterparts, have a 999.local script that executes /etc/monthly.local if it exists.

How to Run Maintenance Scripts on Mac: Two Simple Methods FAQs (Frequently Asked Questions) 

What are maintenance scripts on a Mac?

Maintenance scripts are a part of your macOS system that perform regular clean-up and optimization tasks. They are responsible for deleting temp files, network statistics, duplicate downloads, and Apple-related cache files, making your Mac run more efficiently. They generally run automatically, but can also be manually initiated if required.

How do maintenance scripts automatically run on a Mac?

Maintenance scripts on your Mac are typically programmed to run between 3 and 5 am every day. This is a self-optimizing design of macOS that helps in regular maintenance. However, if your Mac is switched off during these hours, the scripts won’t run and you might miss out on these maintenance tasks.

How can I manually run maintenance scripts on my Mac?

If your Mac is usually off during the hours when maintenance scripts automatically run, you can manually trigger them. This is done via the Terminal app on your Mac. After launching Terminal, you can type in the command: “sudo periodic daily weekly monthly” (without the quotes) and then press Return. You’ll be prompted to enter your Admin password and after that, the scripts will start running.

Can I run maintenance scripts on my Mac without using Terminal?

Yes, if you’re not comfortable using Terminal, you can use third-party applications to run maintenance scripts. One such recommended application is CleanMyMac X. After downloading and installing the app, you can select ‘Maintenance Scripts’ from the ‘Maintenance’ option and then click ‘Run’.

What exactly do these maintenance scripts do on my Mac?

Maintenance scripts on your Mac perform a variety of functions like cleaning up temp files, checking disk space and network interfaces, and managing functions that aren’t heavily used today. Some are still relevant, like the /etc/periodic/daily/110.clean-tmps script, while others are somewhat outdated as they relate to components that aren’t heavily used or don’t exist in modern versions of macOS.

What do daily, weekly, and monthly maintenance scripts do on my Mac?

Daily scripts perform tasks like deleting old files in /tmp and checking local disk space. Weekly scripts include the 999.local script which runs /etc/weekly.local if it exists for backward compatibility purposes. Monthly scripts rotate old fax logs and manage the system accounting system, alongside running /etc/monthly.local if it exists.

Are maintenance scripts still relevant on modern macOS versions?

While many maintenance scripts are considered outdated as they relate to less-used or nonexistent components in contemporary macOS versions, some, like the /etc/periodic/daily/110.clean-tmps, are still relevant. These scripts are part of a legacy system inherited from FreeBSD, and Apple approaches cleanup and maintenance differently in today’s macOS versions.

To top