Spotlight cannot find an application that is installed |
After non-deliberately deleting some native applications I restored them by copying the files from another OS X installation. However, Spotlight couldn't find the applications anymore (but I could run them).
I tried multiple ways to rebuild the Spotlight index as suggested in the community. Nothing did it.
It turns out that the applications had a wrong set of permissions which made them invisible to Spotlight.
After observing the other native applications' files I discovered that:
- The main application directory and all its contents must belong to the user
root
and groupwheel
; - The main application directory and all directories recursively inside of it must have a set of permissions equal to
755
(Traditional Unix permissions); - All files recursively inside the main application directory must have a set of permissions equal to
644
; - The file inside the
Contents/MacOS/
from the main directory must have the set of permissions755
because it must be executable or the application won't run;
The most important aspect is that the file
Now that we know the theoretical aspects of the issue, let's delve into some Terminal exercise:
If the application still doesn't show up in Spotlight, try to force a rebuild of its database:
Contents/Info.plist
be readable in the others class so that Spotlight can view it.Now that we know the theoretical aspects of the issue, let's delve into some Terminal exercise:
- Open up Terminal and
cd
to the directory containing the main directory of the application you want to fix, e.g:cd /Applications/Utilities
. Let's assume the application is called MyApp and its main directoryMyApp.app
; - Set the right owner and group to every file and directory:
sudo chown -R root:wheel MyApp.app
; - Set the general permissions to every file and directory:
sudo chmod -R 775 MyApp.app
; - Change the permissions of only the files:
find MyApp.app -type f -print0 | xargs -0 sudo chmod 644
; - Change the permissions of the actual executable file, to be executable:
sudo chmod 775 MyApp.app/Contents/MacOS/MyApp
;
If the application still doesn't show up in Spotlight, try to force a rebuild of its database:
mdutil -E
Update: Some application files may require specific permissions. Run Disk Utility to verify and repair the disk files' permissions.
References
Traditional Unix permissions