X

Find practically any file in OS X

Spotlight's default search is limited to user files, but if needed you can expand it to include most system files.

Topher Kessler MacFixIt Editor
Topher, an avid Mac user for the past 15 years, has been a contributing author to MacFixIt since the spring of 2008. One of his passions is troubleshooting Mac problems and making the best use of Macs and Apple hardware at home and in the workplace.
Topher Kessler
3 min read

The Spotlight feature in OS X is a convenient tool for locating your files, contacts, e-mails, and other information by searching through an index of file content and metadata in addition to file names. While this feature's primary use is for locating user data and resources you may use, such as Applications and system preferences, it can also be used to find practically any file on the system.

Spotlight's index of your hard drive includes information on practically every file on the drive, but since it is geared toward relevant search results, by default Spotlight does not include options to show system files; however, Apple does include a number of hidden filters that you can use to enable these results in your searches.

These filters are not available through the Spotlight menu, but if you invoke a standard Finder search then you can add combinations of them to suit your needs and find practically any file on the system, be it a listing of a particular type, a specific detail about one file, or even hidden system files.

Spotlight Finder search filters
By adding new filters (the plus buttons) and setting their search criteria (items in the red rectangle), you can expand and highly customize your search results. Screenshot by Topher Kessler/CNET

To do this, simply press Command-F in the Finder to bring up a Finder search, and then click the plus button to the right of the search window to add a new filter. Then select "other" in the first drop-down menu to assign "System files" and "File visibility" for the new filters, followed by adjusting them to include system files and show hidden files.

Once completed, you can then search for a keyword, such as a file name. For example, if you want to locate the "hosts" file in your system to modify some network access parameters, you can enter it in the filtered finder search to reveal it, even though it is hidden.

From the search results, you can right-click a located document and then choose the options to open it or open its enclosing folder to reveal it in the Finder. If you perform this second option on a file that is stored in a normally hidden directory branch, then this hidden folder will show in the Finder where you can access it and peruse its location.

Using these advanced search filters you can also quickly list specific file types in the system. For example, you can locate any audio file on the system, be it a music file or a system- or application-specific sound, simply by including the aforementioned filters and then changing the default "Kind" filter to include only "Music" file types (note that you do not need to include a search term to list files in this manner).

With this approach, you can locate files like "lockClosing.aif" and "lockOpen.aif" buried deep in the SecurityInterface framework, which are the sounds you usually hear when clicking the various authentication locks on the system to unlock system preferences and other secured areas. Similarly, you can change the "Kind" filter to only include "Applications," and thereby list any application on the system and not just those in the /Applications or /Applications/Utilities/ folders.

With these search filtering options you can discover many hidden features of the system by targeting file types, instead of manually exploring the filesystem structure through the Finder. You can also narrow results by starting your search at a specific folder (such as the System/Library folder instead of your user account or the entire system).

Do keep in mind that while these searches can include many new files and locations in the system, they will only do so for files to which your account has access. Therefore, you cannot use them to find files located in another user's account. This is possible to do with root-level access (e.g., if you enable and log in as the root user, or if you use Terminal equivalents to these search options), but this is not possible through normal Finder and Spotlight searches.



Questions? Comments? Have a fix? Post them below or e-mail us!
Be sure to check us out on Twitter and the CNET Mac forums.