Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

Does macOS Search Include System Files?

· 5 min read · Home Tech

In this article
  1. How Spotlight Search Handles System Files
  2. Why System Files Are Excluded by Default
  3. How to Search System Files in Spotlight
  4. Finder Search and System Files
  5. Changing Spotlight's Exclusions
  6. Common Issues and Misconceptions
  7. Alternatives to Spotlight for System Files
  8. Frequently Asked Questions

Yes, macOS Spotlight and Finder search can include system files, but they are hidden from results by default. You can reveal them by using specific search modifiers or disabling system file exclusions in Spotlight's settings.

How Spotlight Search Handles System Files

Spotlight is the built-in search feature on macOS, accessible via the magnifying glass icon in the menu bar or by pressing Command+Space. It indexes the contents of your entire drive, including system files, but it applies a set of exclusions to keep results clean and avoid overwhelming users with technical files. These exclusions are defined in Spotlight's configuration, which you can view with the mdutil and mdfind commands in Terminal.

When you type a query in Spotlight, it searches the index and then filters out results that match certain criteria, such as files in system directories like /System, /Library, and hidden files that start with a dot. This is why a search for "kernel" or "plist" typically shows no system files, even though they exist on your Mac.

Why System Files Are Excluded by Default

Apple excludes system files for several practical reasons:

  • Reducing clutter: System files are numerous and have cryptic names; showing them would make search results nearly unusable for most people.
  • Preventing accidental modification: If users could easily open and edit system files, they might break their system. Hiding them reduces that risk.
  • Performance: Indexing every system file would slow down Spotlight and use more disk space.

For most users, this is the right behavior. You rarely need to access system files directly, and when you do, you likely know the exact path.

How to Search System Files in Spotlight

If you need to find a system file, you can override the default exclusion in a few ways:

  1. Use the system modifier in Spotlight: Type system:filename (e.g., system:hosts) to force Spotlight to search system folders.
  2. Use the filename modifier: Type filename:hosts to match the file name exactly, which sometimes bypasses the exclusion.
  3. Use Terminal: The mdfind command can search the index with more control. For example, mdfind -name hosts will list all files named "hosts" including system ones.

Keep in mind that even with these modifiers, Spotlight may still not show every system file because some are not indexed at all (e.g., files inside certain protected folders).

Finder Search and System Files

Finder's search (opened with Command+F) behaves similarly to Spotlight. It uses the same index and applies the same exclusions. However, you can change the search scope to "System" or "Entire Mac" and then use the "Other" search criteria to include hidden files.

To see hidden files in Finder search results, you can temporarily reveal hidden files by pressing Command+Shift+. (period) while in a Finder window. This shows dotfiles and other hidden items, but it does not change Spotlight's indexing rules.

Changing Spotlight's Exclusions

You can customize which folders Spotlight indexes and searches. In System Settings > Spotlight > Search Results, you can uncheck categories like "System Files" to hide them entirely, or check them to include them. However, this option only controls whether system files appear in results; it does not change the underlying index.

For more granular control, you can add folders to the Privacy tab in Spotlight settings. If you add a folder (like /System) to Privacy, Spotlight will not index it at all, which means searches will not find anything inside it—even with modifiers. This is an extreme measure and not recommended unless you have a specific reason.

Common Issues and Misconceptions

One common misconception is that Spotlight is broken when it doesn't show system files. In reality, it's working as designed. Another issue users face is that after a macOS update, Spotlight may re-index the drive, temporarily showing fewer results. This is normal and resolves on its own.

If you are trying to locate a specific system file and Spotlight won't reveal it, the most reliable method is to use Terminal with find or mdfind. For example, sudo find / -name "hosts" will search the entire drive, including protected areas, but requires admin privileges.

Alternatives to Spotlight for System Files

If you frequently work with system files, consider using a dedicated file manager like ForkLift or Path Finder, which offer advanced search options. Alternatively, you can use the grep command in Terminal to search file contents within system directories, though this is slower and more technical.

Frequently Asked Questions

Why can't I see system files in Spotlight even after using the system: modifier?

The system: modifier tells Spotlight to include system files, but it only works if those files are indexed. Some protected system files are not indexed at all due to macOS's System Integrity Protection (SIP). To access those, you need to use Terminal with elevated privileges.

Does Spotlight index hidden files like .bash_profile?

Spotlight does index hidden files (those starting with a dot) in your home folder, but it does not show them in results by default. You can find them by searching for the exact filename or by using the filename: modifier. In Finder, pressing Command+Shift+. reveals hidden files in the current folder.

How do I make Spotlight search system files permanently?

Go to System Settings > Spotlight > Search Results and check the box for "System Files." This will include system files in future searches. However, it may still not show every protected file due to SIP.

Why did Spotlight stop showing results after a macOS update?

macOS often re-indexes the drive after an update, which can take from a few minutes to an hour. During this time, Spotlight may show incomplete results. You can check indexing status by opening Terminal and running mdutil -s /. If it says "Indexing," wait for it to finish.

Can I use Terminal to search system files faster than Spotlight?

For a one-off search, mdfind is faster because it uses the same index as Spotlight. For a thorough search of unindexed files, find is slower but more comprehensive. Use sudo find / -name "filename" 2>/dev/null to search the entire drive, suppressing permission errors.