System Maintenance

The Pane Maintenance

System Optimization

All applications you are launching are dependent on services of the operating system: The programs are using features of the system, for example to receive click messages from the mouse, or to open windows on screen. Technically seen, this means that each application has to link its own program code with the code libraries of the operating system. Programs typically use several thousand functions available in the system which have to be “located” while the application is starting. These locations, namely the file paths where the code libraries are stored, and the exact byte positions within the libraries are not necessarily fixed: They may change from OS version to OS version, so the applications have to do a lot of work checking and locating all these OS functions at launch time.

Applications try to accelerate this link process at start time by assuming that the code locations remain constant as long as no new operating system updates have been installed since the last launch. They store the required code locations of functions of the operating system into a cache area in their own program codes. So the next time the application is launched, it can simply reuse this saved information and does not need to repeat the whole search process of locating OS functions. The cache only needs to be rebuilt if the application detects that new system libraries have been installed.

This optimization technique is called prebinding. It speeds up the launch time of programs, but does not accelerate the programs themselves. This technique is not restricted to applications only. It is even more important for the system libraries themselves, because they are also using each others functions. For example, the library drawing windows on screen uses features of the graphics library, and the graphics library uses functions of the system kernel. For this reason, code libraries and similar software components, like plug-ins, make use of prebinding, too, although they don’t really have a “startup phase”.

System Optimization
System Optimization

As mentioned in the last paragraphs, each application “re-prebinds” itself to the available libraries when it detects that new libraries have been installed, for example as part of an OS update. In order to anticipate this step, it is a good idea if an upgrade installer simply tells all applications on the computer to re-prebind themselves during, or more exact, just after the update has been installed. The macOS Installer indeed performs this step as last part of each system update. It is done when the message “Optimizing system for installed software” is shown.

It is one of the macOS myths that the system would no longer use any kind of prebinding. This is not true although many Internet pages claim the opposite. The truth is: Modern system versions indeed use a new improved linking technique which eliminates the need of prebinding for applications and third-party code libraries. But system libraries are still prebound, however, and they benefit from this optimization.

This means if a system update installation was interrupted somehow, or if you manipulated one of the system libraries, for example by “downgrading” a specific library via a Time Machine backup, all prebinding information in the system should be updated. To manually start a system-wide prebinding process, perform the following steps:

  1. Open the tab item System Optimization of the pane Maintenance.
  2. Press the button Repeat System Optimization.

Clear Directory Cache

macOS contains a background service which communicates with the directory services configured for your system. This service is the central information broker needed to collect data about users, computers, IP addresses, user groups and many other things relevant to an operating system. Under special circumstances, the internal memory contents of this service may contain incorrect or outdated information, especially if your computer is accessing a name server or directory server which doesn’t work reliably, or if the network configuration has changed abruptly. This can result in unexpected delays (spinning rainbow cursor) especially when using network functions.

Clear directory cache
Clear directory cache

In this situation, clearing the online cache of directory services might correct the problem: The information broker will begin with fresh new data it fetches from your network and the local computer. Note that this cache is not stored in any file. It is kept in the online memory of the directory services subsystem of macOS.

The word “directory” is sometimes used as a technical term for a folder storing files. This is not what is meant here. In this context, the word directory refers to an inventory list of names, objects and network addresses relevant to your computer. macOS is always running a directory service no matter if the computer is connected to a network or not.

When retrieving data about names and network addresses of other computers, the directory services are not the only source of information which keep records in their internal cache memory for some time. The system service acting as “DNS resolver”, responsible for finding addresses for computer names and vice versa, assists the directory services in doing their job. When you clear the memory cache, you can decide whether only the records of directory services as such should be cleared, or if cached DNS information should be removed as well.

To clear the directory cache of macOS, perform the following steps:

  1. Open the tab item Clear Directory Cache of the pane Maintenance.
  2. Select one the radio buttons to indicate if the cache of the DNS resolver should be included in the cleaning operation.
  3. Press the button Clear Cache.

Locate Database

Because macOS is a UNIX system, it comes with the program “locate”, a command-line application to quickly find files by their names or parts of their names. Locate is usually faster than Spotlight when searching for names and does not distinguish between visible and invisible files. Similar to Spotlight, locate needs an internal database to do its job. This database is updated in regular intervals to ensure that the program has current information about new and deleted files.

Locate database
Locate database

Because most users don’t work with macOS command-line programs, the automatic service that updates the locate database is switched off by default. The information whether the service is currently on or off is available to administrative users only. Perform the following steps to see if the update service is active or not:

  1. Open the tab item Locate Database of the pane Maintenance.
  2. Press the button Show current status.

The current state will now be displayed by the check mark at macOS should update the locate database periodically. You can now either set the check mark to activate automatic maintenance of the database, or remove the check mark to shut down this service.

In a default installation of macOS, the system will update the locate database automatically each Saturday at 3:15 a.m. If your computer is off or in sleep mode at that time, the update is automatically postponed to a later date where the system is active. To enforce an immediate update of the locate database “now”, press the button Update database now.