Can’t find a file in macOS? Here’s what to do

Macworld reader Lon has a problem finding a file on his Mac. He
needs to remove it to avoid a compatibility problem, and no
amount of Spotlight searches nor browsing through folders can
find it.

Spotlight should let you find nearly any file you create or
store in macOS with ease, but it doesn’t always work that way.
There’s a way to search comprehensively through your macOS
drive (or drives) using the Terminal, but I think of it as a
last resort, because it involves tricky syntax and can be slow.
It also may match a lot of files you’re not interested in.

In the Terminal, a command called find can perform
a comprehensive and deep search across everything, including
system files and other stuff that we don’t need to interact
with and macOS doesn’t readily expose to users. (Find is
something I’ve used for decades, and it feels like a tool
designed for a computer with a teletypewriter attached.)

mac911 terminal find command
IDG

The Unix find command shows the full path of matching
files, wherever they exist on disk.

In this example, let’s assume I’m looking for a file I know is
named easysolutions.mdl, and I’m going to search
on just easysolutions as the unique portion. The
search pattern I show below is case independent, so uppercase
and lowercase letters get matched regardless of what you
specify. If you need to use a space, enclose the text in
quotation marks, like "easy solutions".

  1. Launch Terminal, which you’ll find in Applications
    > Utilities.
  2. Switch to superuser, which requires an administrative
    account. You enter
    sudo su -
    and press Return, and then enter the administrative password.
    If it’s the first time you’ve used sudo, macOS
    also warns you about the dangers of having system super
    powers.
  3. You can include part or all of a file name in the search.
    Type exactly
    find / -name easysolutions -print
  4. This may take some time to process. It could be several
    minutes as macOS matches against every one of hundreds of
    thousands or millions of individual files. Each result appears
    as a separate entry.
  5. When you see the file appear, it will be proceeded by its
    full path name. Copy the path from the first / to
    the last / before the file name, like
    /Library/Application
    Support/BingoBongo/settings/preferences/config/
  6. Now in the Finder, choose Go > Go To
    Folder
    , and paste in that path.
  7. The folder will open. In some cases, you may have to
    authorize opening the folder, entering an administrative
    account name and password.
  8. If you’re sure the file you see is the one you want to
    delete, move, or interact with, you’re all set.

During this find operation, you will see entries you can
ignore, like:

find: /path/name/here/filename.txt: Operation not
permitted

or

find: /dev/fd/3: Not a directory

Even though you’re a superuser, the underlying Unix operation
system and Apple’s specific modifications prohibit some kinds
of operations.

Once you’re done, return to Terminal and press Control-D or
type exit and press Return to leave superuser
status. (The # at the far left will change to a
$.)

Ask Mac 911

We’ve compiled a list of the questions we get asked most
frequently along with answers and links to columns:
read our super FAQ
to see if your question is covered. If
not, we’re always looking for new problems to solve! Email
yours to [email protected] including screen captures as
appropriate, and whether you want your full name used. Every
question won’t be answered, we don’t reply to email, and we
cannot provide direct troubleshooting advice.

%d bloggers like this: