# Missing toolchain modules on macOS?

**URL:** <https://forums.swift.org/t/missing-toolchain-modules-on-macos/71649>\
**Category:** Compiler\
**Tags:** symbolgraphgen\
**Created:** [May 6, 2024, 9:02pm UTC](https://forums.swift.org/t/missing-toolchain-modules-on-macos/71649 "2024-05-06T21:02:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![taylorswift](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/taylorswift/32/43413_2.png) [@taylorswift](https://forums.swift.org/u/taylorswift)\
**Post date:** [May 6, 2024, 9:02pm UTC](https://forums.swift.org/t/missing-toolchain-modules-on-macos/71649/1 "2024-05-06T21:02:01Z")

</div>

when running `swift symbolgraph-extract` on linux, i get the following modules by default:

```swift
$ swift symbolgraph-extract -module-name x -target x86_64-unknown-linux-gnu -output-dir ~/test
Couldn't load module 'x' in the current SDK and search paths.
Current visible modules:
CDispatch
CFURLSessionInterface
CFXMLInterface
CoreFoundation
Cxx
CxxStdlib
Dispatch
DispatchIntrospection
Distributed
Foundation
FoundationNetworking
FoundationXML
Glibc
Observation
RegexBuilder
Swift
SwiftBridging
SwiftGlibc
SwiftOnoneSupport
SwiftOverlayShims
SwiftShims
XCTest
_Backtracing
_Builtin_intrinsics
_Builtin_stddef_max_align_t
_Concurrency
_Differentiation
_InternalStaticMirror
_InternalSwiftScan
_RegexParser
_StringProcessing
_SwiftConcurrencyShims

```

on macOS, some of these seem to be missing.

1. `_RegexParser`
2. `_Differentiation`
3. `XCTest`
4. `FoundationNetworking`
5. `FoundationXML`

i’m aware that the Foundation modules are supposed to be different due to macOS adopting the `swift-foundation` project, but i am surprised that `_RegexParser`, `_Differentiation`, and `XCTest` are also missing. is this expected?

---

<div class="post-metadata">

**Author:** ![Alejandro](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/alejandro/32/46197_2.png) [@Alejandro](https://forums.swift.org/u/Alejandro)\
**Post date:** [May 6, 2024, 9:10pm UTC](https://forums.swift.org/t/missing-toolchain-modules-on-macos/71649/2 "2024-05-06T21:10:32Z")

</div>

`Foundation` is provided by the OS on macOS so it is not currently built as part of the toolchain build. `_RegexParser` is an implementation module used by the compiler and the string processing module, so I'm not surprised that it's stripped from the final toolchain build. `_Differentiation` is still a very experimental module that's not meant for public consumption (yet?), and `XCTest` is provided by the OS on macOS as well.

---

<div class="post-metadata">

**Author:** ![taylorswift](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/taylorswift/32/43413_2.png) [@taylorswift](https://forums.swift.org/u/taylorswift)\
**Post date:** [May 6, 2024, 9:11pm UTC](https://forums.swift.org/t/missing-toolchain-modules-on-macos/71649/3 "2024-05-06T21:11:59Z")

</div>

is it possible to emit their symbolgraphs on macOS, or are they unavailable?

---

<div class="post-metadata">

**Author:** ![allevato](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/allevato/32/385_2.png) [@allevato](https://forums.swift.org/u/allevato)\
**Post date:** [May 6, 2024, 11:50pm UTC](https://forums.swift.org/t/missing-toolchain-modules-on-macos/71649/4 "2024-05-06T23:50:51Z")

</div>

`XCTest` is the only one that's really relevant here, because it's the only one that's a public module available on macOS. `_Differentiation` is experimental and not shipped with Xcode toolchains, `_RegexParser` is a private implementation detail as Alejandro mentioned (clients should not use it), and `Foundation(Networking|XML)` are Linux-only splits; `Foundation` on macOS isn't structured that way.

`XCTest` is distributed as a developer framework in Xcode, so in addition to providing the SDK search path, you also need to add the platform's developer frameworks path to the `swift` invocation. This works for me:

```shell
xcrun swift symbolgraph-extract -module-name XCTest \
  -target arm64-apple-macos14.2 -output-dir . \
  -sdk $(xcrun --sdk macosx --show-sdk-path) \
  -F $(xcrun --sdk macosx --show-sdk-platform-path)/Developer/Library/Frameworks

```
