Skip to content

mdutil MacOS Command Guide

The MacOS mdutil command is used to manage Spotlight indexing on your system. This powerful tool allows you to enable, disable, or check the status of indexing on specific volumes or directories. By using mdutil, you can control which files and folders are being indexed by Spotlight, helping you to improve search efficiency and save system resources. Additionally, you can use mdutil to force a reindex of a specific volume, ensuring that the Spotlight database is up to date. Overall, the mdutil command is a valuable tool for customizing and optimizing Spotlight indexing on your MacOS system.

mdutil Syntax:

Terminal window
mdutil [options] [parameters]

Options:

OptionDescription
-i onTurn indexing on
-i offTurn indexing off
-EErase and rebuild index
-sPrint indexing status
-pSpotlight search a file

Parameters:

ParameterDescription
volumeThe volume to operate on
pathThe path to a specific file or directory to operate on

mdutil Command Samples:

Enable Spotlight indexing on a specific volume

Terminal window
mdutil -i on /Volumes/Data

Enables Spotlight indexing on the volume “Data”.

Show the indexing status of a specific volume

Terminal window
mdutil -s /Volumes/Data

Displays the indexing status of the volume “Data”.

Turn off Spotlight indexing for a specific path

Terminal window
mdutil -i off /Users/username/Documents

Disables Spotlight indexing for the specified path.

Enable Spotlight indexing for all volumes

Terminal window
mdutil -a -i on

Enables Spotlight indexing for all volumes.

Show the indexing status for all volumes

Terminal window
mdutil -sa

Displays the indexing status for all volumes.

Turn off Spotlight indexing for all volumes

Terminal window
sudo mdutil -a -i off

Disables Spotlight indexing for all volumes. Be cautious as this may impact search functionality.

Display help information for the mdutil command

Terminal window
mdutil -h

Shows the help manual for the mdutil command, providing information on its usage and available options.

How do I use mdutil in MacOS?

To use the mdutil command in MacOS, execute the following command:

Terminal window
mdutil --enable /Volumes/DriveName

How can I disable Spotlight indexing with mdutil?

You can disable Spotlight indexing using the mdutil command as shown below:

Terminal window
mdutil -i off /Volumes/DriveName

How do I check the indexing status of a specific volume using mdutil?

To check the indexing status of a specific volume, use the mdutil command with the -s flag:

Terminal window
mdutil -s /Volumes/DriveName

How do I force Spotlight to reindex using mdutil?

To force Spotlight to reindex a specific volume, you can use the -E flag with mdutil. Here’s an example:

Terminal window
mdutil -E /Volumes/DriveName

How can I exclude a specific folder from Spotlight indexing using mdutil?

You can exclude a specific folder from Spotlight indexing by adding it to the Privacy list with mdutil. Here’s how you can do it:

Terminal window
mdutil -p /Path/To/Folder

How do I clear the entire Spotlight index using the mdutil command?

You can clear the entire Spotlight index on a volume by using the -E flag with mdutil. Here’s the command to clear the index:

Terminal window
mdutil -i off /Volumes/DriveName
mdutil -E /Volumes/DriveName
mdutil -i on /Volumes/DriveName

Applications of the mdutil command

  1. Enable metadata indexing on a volume
  2. Disable metadata indexing on a volume
  3. Check the indexing status of a volume
  4. Modify indexing options for a volume
  5. Delete all metadata indexes on a volume