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

macos

Running this command sudo find / -iname *.app, among the entries returned was:

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

Why is this and how can I fix it?

Best Answer

sudo find -x / -iname *.app

or

sudo find / -iname *.app 2>/dev/null

The first solution prevents find from descending into directories that have a device number different that that of the file from which the decent began. This prevents the errors from occurring, but limits the search to a single device.

The second solution does not stop the error messages from being generated. Instead, the message are just discarded so you do not see them. This solution discards not only the error messages you describe, but rather all error messages.