On a MacBook, I tried to access one of the system apps, Maps.app which is normally a folder stored in /System/Applications on a separate volume (here mounted as /System/Volumes/Data). What I found odd is that ls, cd and stat all seem to pretend the folder isn't there - however, find happily finds it.
$ find /System/Volumes/Data -name 'Maps.app'
/System/Volumes/Data/System/Applications/Maps.app
# some access denied errors for other subfolders
$ stat /System/Volumes/Data/System/Applications/Maps.app
stat: /System/Volumes/Data/System/Applications/Maps.app: stat: No such file or directory
$ cd /System/Volumes/Data/System/Applications/Maps.app
cd: The directory '/System/Volumes/Data/System/Applications/Maps.app' does not exist
$ cd /System/Volumes/Data/System/Applications
cd: The directory '/System/Volumes/Data/System/Applications' does not exist
$ cd /System/Volumes/Data/System
# this worked
$ ls -la@O # pwd is /System/Volumes/Data/System
total 0
drwxr-xr-x@ 3 root wheel restricted 96 6 Mar 11:06 ./
com.apple.rootless 0
drwxr-xr-x@ 18 root wheel - 576 30 Mar 19:07 ../
purgeable-drecs-fixed 4
drwxr-xr-x 9 root wheel restricted 288 6 Mar 11:06 Library/
$ find . -name 'Maps.app'
# nothing found - only works on the parent folder
I'm aware that given this is happening on MacOS and that folder has special flags such as com.apple.rootless and restricted, but I'm curious about whether there's some mechanism in Unix that's used to produce this effect. Specifically, what mechanism can be used to prevent a specific folder / tree from being visible and what does find do differently from ls which allows it to bypass this?
/System/Volumes/Datadirectory is a bit special on macOS. For one, it's not browsable. You may want to search in/System/Applicationinstead (a virtual directory mounted from/System/Volumes/Data/Application). Also, you have likely edited the output fromfind, right? Either all the error messages or the way you are invoking it./System/Applicationworks, but I wanted to delete some of these apps and realized that even if I remount that disk as writeable in recovery, the applications are still not visible and I got curious how this is done.Applicationsfolder in the Finder to the bin.