If you’ve ever run into the dreaded Xcode error:

<unknown>:0: error: missing required module '_NumericsShims'

…then you know the pain of debugging something that seems to appear out of nowhere. In my case, this error started popping up in completely unrelated places—empty Swift files, random modules—leaving me absolutely clueless. I spent an entire day digging through build settings, dependency trees, and Stack Overflow posts before finally finding the fix.

The Setup

My app follows a modular architecture using Swift Packages. Everything was working fine until, suddenly, _NumericsShims went missing.

At first, I thought it was a corrupt Xcode cache issue, so I tried:

  • Cleaning the build folder (Cmd + Shift + K)
  • Resetting the Swift Package cache (File → Packages → Reset Package Caches)
  • Reinstalling dependencies (File → Packages → Resolve Package Versions)

None of it worked.

The Fix

The missing _NumericsShims module was indirectly required by swift-algorithms, and adding this dependency resolved the issue instantly.

.product(name: "Algorithms", package: "swift-algorithms")

Why Does This Happen?

Swift’s package resolution system doesn’t always link transitive dependencies correctly, especially when modularizing an app. Some dependencies, like swift-numerics, can introduce hidden requirements that aren’t immediately obvious.

If you’re using Swift Packages and get this error, check if your module is missing an explicit reference to swift-algorithms or swift-numerics. Adding .product(name: "Algorithms", package: "swift-algorithms") often resolves it.

Final Thoughts

This issue was frustrating, but it served as a reminder that even weird Xcode errors have logical explanations—eventually. If you’re stuck, try inspecting dependencies and ensuring all required modules are explicitly linked.

Hopefully, this saves someone else a day of debugging! 🚀