I discovered an interesting form of corruption within some application bundles which had been stored on a file server for months and years.
The application bundles were installers for various macOS versions, if it matters. I attempted to run
Install macOS High Sierra.app. It ran for a few seconds, then hung. I had to Force Quit the installer from Activity Monitor. The relevant clue in the Console was:
2019-09-02 05:44:29.222 com.apple.xpc.launchd: (com.apple.install.osinstallersetupd) Could not find and/or execute program specified by service: 2: No such file or directory: /Applications/Install macOS High Sierra.app/Contents/Frameworks/OSInstallerSetup.framework/osinstallersetupd
Using the Terminal to explore the contents of the installer app (which is of course a Application Bundle directory), I found this where the installer was looking for
% cd /Applications/Install\ macOS\ High\ Sierra.app/Contents/Frameworks/OSInstallerSetup.framework % ls -l total 16 -rwxrwxrwx 1 jdlh admin 33 9 Jul 2018 OSInstallerSetup -rwxrwxrwx 1 jdlh admin 26 9 Jul 2018 Resources drwxrwxrwx 4 jdlh admin 136 9 Jul 2018 Versions % more OSInstallerSetup Versions/Current/OSInstallerSetup % more Resources Versions/Current/Resources
Resources were plain files, containing relative paths as text. I looked in the corresponding place in a freshly-downlowed, and correctly running, installer:
% ls -l /Applications/Install\ macOS\ Mojave.app/Contents/Frameworks/OSInstallerSetup.framework total 16 lrwxr-xr-x 1 root wheel 33 2 Sep 05:23 OSInstallerSetup -> Versions/Current/OSInstallerSetup lrwxr-xr-x 1 root wheel 26 2 Sep 05:23 Resources -> Versions/Current/Resources drwxr-xr-x 4 root wheel 136 2 Sep 05:23 Versions
So it seems
Resources were supposed to be symbolic links ("symlinks"), not files.
I had downloaded this installer in mid-2018 to my MacBook Pro, then copied it using Finder to the file server. The file server presents an AFP volume to my Macbook using netatalk software. I would expect the Finder to copy symbolic links correctly.
What might have caused this corruption? How can I detect other instances where it occurred, in this app and in others? Can I repair the corruption? It seems like it ought to be possible, given that the file which replaces the symlink has contains the relative path the symlink should have. How can I prevent it from happening again?