Skip to content

update: false-positive "not indexed in Spotlight" warning for Xcode despite full App Store metadata #1249

@regevbr

Description

@regevbr

Problem

mas update outputs the "not indexed in Spotlight" warning for /Applications/Xcode.app on every invocation, even though:

  1. Xcode has full kMDItemAppStore* metadata in Spotlight.
  2. mas list and mas upgrade themselves work correctly (Xcode is not included in the output, suggesting mas's internal Spotlight query doesn't see it — yet the filesystem walk does, hence the warning).

The auto-indexing nudge mas performs has no effect — re-running mas update reproduces the warning every time. mdimport, mdimport -r, and reimporting the Application importer all fail to fix it.

Reproduction

$ mas upgrade
Warning: Found a likely App Store app that is not indexed in Spotlight in /Applications/Xcode.app

         Indexing now; will likely complete sometime after mas exits

         Disable auto-indexing via: export MAS_NO_AUTO_INDEX=1

Diagnosis

The root cause appears to be a macOS Spotlight scoping bug for the Xcode bundle. Unscoped mdfind returns Xcode; scoped queries under either /Applications or /System/Volumes/Data/Applications do not:

$ mdfind "kMDItemAppStoreAdamID == 497799835"
/Applications/Xcode.app

$ mdfind -onlyin /Applications "kMDItemAppStoreAdamID == '*'"
/Applications/Amphetamine.app
/Applications/Perplexity.app
/Applications/Keynote Creator Studio.app
/Applications/Numbers Creator Studio.app
/Applications/Pages Creator Studio.app
# Xcode missing

$ mdfind -onlyin /System/Volumes/Data/Applications "kMDItemAppStoreAdamID == '*'"
# same result, Xcode missing

If mas v7 uses NSMetadataQuery scoped to /Applications (or the firmlinked equivalent) to enumerate App Store apps, Xcode will reliably be missed — but the filesystem walk for Contents/_MASReceipt/receipt will reliably find it. That mismatch is the warning trigger.

Environment

  • mas 7.0.0 (Homebrew, Apple Silicon)
  • macOS 26.5 (25F71), arm64
  • Xcode 26.5 (17F42), installed from the App Store
  • /Applications/Xcode.app/Contents/_MASReceipt/receipt: 4837 bytes, present

Selected Xcode Spotlight metadata

kMDItemAppStoreAdamID         = 497799835
kMDItemAppStoreHasReceipt     = 1
kMDItemAppStoreIsAppleSigned  = 1
kMDItemAppStorePurchaseDate   = 2026-05-12 00:20:55 +0000
kMDItemAppStoreReceiptType    = "Production"
kMDItemCFBundleIdentifier     = "com.apple.dt.Xcode"
kMDItemContentType            = "com.apple.application-bundle"
kMDItemPath                   = "/System/Volumes/Data/Applications/Xcode.app"

mdutil -s / and mdutil -s /System/Volumes/Data/Applications both report indexing enabled.

Suggested fix

Since this is a macOS limitation mas likely can't fully work around, a couple of options:

  • Fall back to an unscoped NSMetadataQuery (filtering paths to the Applications folders in code) when a _MASReceipt/receipt is found on disk but the scoped query doesn't return the bundle — this would have found Xcode in our case.
  • Suppress the warning after the auto-indexing attempt has been made once per run, since for cases like Xcode the indexing nudge will never succeed and the warning is purely noise.
  • At minimum, add a --quiet / MAS_SUPPRESS_INDEX_WARNINGS=1 knob — MAS_NO_AUTO_INDEX=1 only disables the indexing attempt, not the warning text.

Happy to test patches.

Metadata

Metadata

Assignees

Type

No fields configured for Bug.

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions