Spotlight doesn't show my app

I recently developed my first Objective-C + SwiftUI app for MacOS.

After building the dmg file, I installed it by dragging the .app file into the /Applications directory. When I fire up spotlight and try searching for my app, it doesn't show it. I have used cmake to bootstrap the entire project.

I have tried installing this on multiple other Macbooks and the app doesn't show in those systems as well.

I tried creating a new app directly from Xcode and that app shows on spotlight search. I am very new to MacOS development and I don't know if I have missed anything. Please help me figure out what I have missed.

MacBook Pro 16″, macOS 11.0

Posted on Dec 21, 2022 3:06 AM

Reply
24 replies

Dec 22, 2022 8:11 AM in response to KrimsonHart

KrimsonHart wrote:

Yes sir, it has actually been overnight. I have been trying possible solutions from google from the last couple days. So I am pretty positive that it is not an issue with indexing.

Anyway, reindexing does show a progress bar when you try accessing spotlight, so I am sure that reindexing has ben successful a few times.


Make sure the quarantine flag is not set on the app. Try running the app first, and use that to detect and to clear the quarantine flag, if set here. (see related link, below.)


If not… Download and run EtreCheck, and share the results to the clipboard. Then open a new reply here, and press the additional text button—the button that looks like a printed page—to get a text input box big enough to paste the hardware and software configuration report here, and paste and post that report here.


There’s something seemingly odd with your Mac.


This all assuming it’s not the quarantine flag, and assuming the location you’re building into or are copying into is not simply blocked by Spotlight. And /Applications is not usually blocked.


Related: https://eclecticlight.co/2017/12/11/xattr-com-apple-quarantine-the-quarantine-flag/

Dec 28, 2022 4:49 PM in response to MrHoffman

MrHoffman wrote:

Also: https://theevilbit.github.io/posts/macos_persistence_spotlight_importers/ (an intro to the same importer stuff, but for different purposes than verification)

That's just the client API for spotlight. I'm working on one right now for my app. The idea is that if someone tries to do a Spotlight search for some developer name listed in the new Ventura "background apps" settings, it will return a document where I've printed out that developer name. Then they can cross-reference the name and see exactly what file they need to look at. Otherwise, those developer names never occur anywhere on the system. My app extracts those using the low-level security API and stores it in a document. The Spotlight importer reads the document (which is just a gzipped XML file), finds the developer names, and sends them to Spotlight to be indexed.


The key part, as far as the OP is concerned, is that part where it reads the document for information to add to Spotlight. In my case, I designed the document so I know how to parse it. It's the same with Apple. But Apple is a big company. The team that wrote the Spotlight importer for apps is different than the team that executes apps. They have a much more narrow concept of what constitutes an "app". But their implementation is not documented anywhere.


The OP could compare a valid, "hello world" app generated with both cmake and Xcode, learn cmake internals, and submit a patch, and probably in the process learn whatever magic cmake setting was missing. Then again, an easier option might be to just use Xcode. As added benefit, the Xcode app isn't going to break on the next OS version update.

Dec 21, 2022 9:29 AM in response to KrimsonHart

This misbehavior is likely not related to app development.


If you’re really still using macOS 11.0 as per the footer, apply the current update macOS 11.7.2, or (if your Mac supports it) the current Monterey or Ventura.


If the footer here is bogus or if the “wrong” Mac was selected when posting, rebuild the Spotlight index:

Rebuild the Spotlight index on your Mac - Apple Support


Dec 28, 2022 9:20 AM in response to MrHoffman

MrHoffman wrote:

So if you build a “Hello World” app using Swift and Xcode and then place that in Applications, is that found?

The OP has already said that apps make by Xcode work normally.

So what is different about this current app?

OP is using cmake, which apparently can't generate a properly structured app. It may be enough to execute, but the Spotlight importer doesn't recognize it as an app.


Dec 21, 2022 6:58 PM in response to MrHoffman

Hi MrHoffman.


I am really sorry about the footer. My Mac is currently running 12.6.


I have used

sudo mdutil

to rebuild the index on my Mac. In another thread on the community, they suggested going into safeboot mode and restarting normally would reindex spotlight. I did that as well. That in fact removed all cached apps and stuff (I was seeing old apps I had deleted as well)


Also, like I mentioned earlier, All other third-party apps show up properly. Apps that I bootstrap with Xcode also shows up properly. Only this app that we have bootstrapped with cmake isn't showing up.


It is also not showing up on multiple other Macbooks. I tried and tested it on my colleagues' laptops as well and it doesn't index in spotlight, which is why I am concerned if there is an Xcode setting / env switch that I need to set from cmake?

Dec 28, 2022 11:00 AM in response to MrHoffman

MrHoffman wrote:

I don’t know of a lint or analyzer tool for app bundles, either.

There is Apparency, but it's not really what you are talking about. I don't know of any tool to validate an app for Spotlight.


I used to answer questions on the Developer forums for people who couldn't get Notarization to work. It was always the same thing - some custom build tool and various open-source frameworks. I would try to get people to look at any other app, compare the structure of that app, and compare what they are generating. Total non-starter. They wouldn't even consider that. Curiously, Apple engineers didn't seem to care much. I think they were just trying to get DTS tickets. But Apple is way too lenient about launching apps. That confuses people when the app runs, but then won't notarize, or won't run after notarizing, or won't register with Spotlight.


Then the hackers find some security exploit due to a maliciously constructed app. Apple doesn't care about that either because they can patch the bug and drive more updates. But obviously the Spotlight importer team has a different opinion about what constitutes a searchable app.

Dec 23, 2022 1:33 AM in response to MrHoffman


Hi MrHoffman,


As suggested, I checked the following - Please let me know if it was inaccurate / you were looking for something different.


Make sure the quarantine flag is not set on the app


I checked this in the info.plist file of the app for the field - LSFileQuarantineEnabled. I couldn't find it listed so I think the flag is not set?

The app is copied into the /Applications folder. I checked the spotlight Search Results tab and Applications is enabled. And the path is not included in the Privacy section to disable search on the location.


I have attached the EtreCheck report as suggested to this reply. Please let me know if you need any other details to help! Thanks.


Dec 25, 2022 12:01 AM in response to MrHoffman

Hi MrHoffman,


Sorry for the late reply.

I use docker for Frontend and Backend development. The VPN is mostly turned off unless I need to work on the servers.


The release build happens on Azure Cloud. The issue seems to persist on the Azure builds as well. However, to validate your suspicion above, I will try configuring the code and running a build on another Mac at work. I will be able to access this system on wednesday. I will report the findings then. If you have any other suggestions, I'd be happy to try them out till then.


Thanks

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Spotlight doesn't show my app

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.