Xcode Simulators not appearing in Spotlight

So, as the subject title states, I don't get any results by searching for 'Simulator' in Spotlight, (neither the main one, nor 'Simulator (Watch)'). This was working after installing Xcode when I first received my Mac [MBP 2016, to be clear].


To set up some context, I want to explain what I did before encountering the problems I'm having right now, as there may be something that stands out to some of you...

I reinstalled 10.12 [specifically 10.12.5] via Internet Recovery, a short while back, due to some fundamental problems with 10.13 [even the public beta is under NDA, so it of course can't be discussed specifically; but given that I reinstalled, this shouldn't be too relevant, anyway].

I did `cp -Rp` most of my data over, as I didn't have a Time Machine set up.


But anyway, following a reinstall of 10.12, I moved back all of home, save for a few items in `~/Library/`, where there may have been some risky conflicts.

Additionally, I copied back all of my non-Apple apps into `/Applications/`, so as to avoid inevitable problems there and I skipped on anything that would require installing from .pkg files, due to missing daemons.


Finally, whilst I had initially planned to copy back `/Library/Application Support/`, I opted not to so, due to issues I encountered the first time I reinstalled [I had to repeat the process because of this].

Additionally, I recall reaffirming the permissions with `sudo chown root:wheel` on some of the directory locations where I copied data to, from my manual backup.


Moving forward, I (re)installed Xcode [new for this installation], but it didn't appear in Spotlight. Forcing a re-index worked but strangely, 'Simulator' - which previous returned both the normal and Watch simulators - did not appear.

I tried reinstalling Xcode to confirm, with no luck.


Following some investigation, I recently decided to go down the heavy route of removing any reference to Xcode that I could:

  • Uninstalling Xcode
  • Uninstalling the Xcode Command Line Tools
  • Deleting Xcode .plist files under both ~/Library/Preferences, as well as /Library/Preferences
  • Deleting contents withing ~/Library/Developer, inculding the 'CoreSimulator' device simulator images
  • Removing Xcode caches from ~/Library/Caches
  • References in ~/Application Support/Xcode

...and any other traces that I could find from a manual search.


I've carried out all steps mentioned in here:


On top of this, I believe I also properly destroyed the hidden Spotlight directory (`/.Spotlight-V100`) to let it rebuild from scratch; but all of this combined and in different orders, with rebooting in between before reinstalling Xcode + the command line tools, hasn't worked.


I do still have to force a Spotlight re-index (each time I reinstall Xcode) in order to have Xcode appear in Spotlight, but I can't remember if that's normal or not and whether or not it occurred with my original, shipped installation of macOS, as other applications don't seem to have the same problem when I install them.


Answers to likely questions:

  1. Yes, I can still launch the Simulators from Xcode
  2. No, I don't really want to reinstall again: as much as Time Machine may not have been set up and ready before and with it working now, I see little use in restoring to its current state, as that will surely only restore with the problem at present; and with the sheer amount of configuration, applications and data on there, it'd be quite the major hassle and setback. It's the only apparent remaining issue that I've noticed, with every other snag I've noticed being resolved.
  3. The only other mention I've seen of the same problem, here, is: https://forums.developer.apple.com/thread/50504, but it never got a clear solution; and unlike one of the responses suggested in this post, every Spotlight option is toggled.


I hope that someone may have the answers, as standard Apple Support won't deal with any developer-related software, even if it's 'public' from Apple and not under the 'Apple Developer Program'.


Many thanks in advance.


Edit:

  • I realised that the Xcode Build Server app also does not get found in Spotlight.
  • `mdls` [e.g. `mdls /Applications/Xcode.app/Contents/Developer/Applications/Simulator.app`] finds them, but `mdfind` does not.
  • I also reset Launch Services, with both `/System/Library/Frameworks/CoreServices.framework/Versions/A/Frameworks/LaunchServices.framework/Versions/A/Support/lsregister -kill -r -domain u -domain s -domain l -v` and `/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Support/lsregister -kill -r -domain local -domain system -domain user`, as well as via onyX's 'Maintenance' panel, along with the daily, weekly and monthly cron jobs.
  • macOS' Safe Boot mode also did nothing to help remedy the situation I don't know quite what should be seen under Console, but current observations show 'failures' to detect the "runtimes" for the iPhone, Watch, or TV simulators ...constantly, (every couple of seconds)

Accepted Reply

So, I finally discovered a solution, although I'm still baffled as to why this was a problem.


Installing the Xcode 9 beta gave me the ability to compare the `mdls` response for the Simulator apps, leading me to notice the obivous that had been there:

A user ID and group ID of 0, for each.


I then checked the permissions for Xcode.app at the top level and found it to be an overall problem.


So, I recursively wrote over the permissions with `chown $(whoami):staff -R /Applications/Xcode.app/` and instantly, the missing Simulators and any other Xcode dev apps contained within instantly appeared in Spotlight.


What still baffles me is how and why this remained a problem after removing all known traces of Xcode and how it being recreated restored the borked user:group permissions. (I'd be very interested in knowing, if someone wouldn't mind taking the time to explain how this could happen).

I'm used to a GNU/Linux environment, where `sudo rm -rf` on a directory, among other configuration being cleared out, would mean that a newly created directory in its place would hold newly created permissions.


Anyway, that was the solution and, hopefully, someday, this'll come in handy for someone else.

Replies

So, I finally discovered a solution, although I'm still baffled as to why this was a problem.


Installing the Xcode 9 beta gave me the ability to compare the `mdls` response for the Simulator apps, leading me to notice the obivous that had been there:

A user ID and group ID of 0, for each.


I then checked the permissions for Xcode.app at the top level and found it to be an overall problem.


So, I recursively wrote over the permissions with `chown $(whoami):staff -R /Applications/Xcode.app/` and instantly, the missing Simulators and any other Xcode dev apps contained within instantly appeared in Spotlight.


What still baffles me is how and why this remained a problem after removing all known traces of Xcode and how it being recreated restored the borked user:group permissions. (I'd be very interested in knowing, if someone wouldn't mind taking the time to explain how this could happen).

I'm used to a GNU/Linux environment, where `sudo rm -rf` on a directory, among other configuration being cleared out, would mean that a newly created directory in its place would hold newly created permissions.


Anyway, that was the solution and, hopefully, someday, this'll come in handy for someone else.