# How do I get swift-inspect to work on macOS

**URL:** <https://forums.swift.org/t/how-do-i-get-swift-inspect-to-work-on-macos/70648>\
**Category:** Using Swift\
**Tags:** performance\
**Created:** [March 13, 2024, 3:59pm UTC](https://forums.swift.org/t/how-do-i-get-swift-inspect-to-work-on-macos/70648 "2024-03-13T15:59:53Z")\
**Posts on this page:** 8\
**Page:** 2

<div class="post-metadata">

**Author:** ![hassila](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/hassila/32/22647_2.png) [@hassila](https://forums.swift.org/u/hassila)\
**Post date:** [March 26, 2024, 5:47pm UTC](https://forums.swift.org/t/how-do-i-get-swift-inspect-to-work-on-macos/70648/21 "2024-03-26T17:47:50Z")

</div>

Closer and closer, but still not quite! 🙂

This is running with Hardened Runtime off, but with original `swift-inspect` in original location without changes - `dump-conformance-cache` works, we still crash though for arrays and concurrency!

```swift
  See 'swift-inspect help <subcommand>' for detailed help.
hassila@ice ~/g/ordo (main)> swift-inspect dump-arrays 62326
Address	Size	Count	Is Class
0x600000200000	128	5	false
0x600000200600	128	5	false
0x600000200c00	128	5	false
0x600000201200	128	5	false
0x600000201800	128	5	false
0x600000202a80	128	5	false
0x600000202f80	128	5	false
0x600000203700	128	5	false
0x600000203d00	128	5	false
0x600000300a00	128	4	false
0x600000300c00	128	2	false
0x600000300d00	128	3	false
fish: Job 1, 'swift-inspect dump-arrays 62326' terminated by signal SIGBUS (Misaligned address error)
hassila@ice ~/g/ordo (main) [SIGBUS]> swift-inspect dump-concurrency 62326
TASKS
fish: Job 1, 'swift-inspect dump-concurrenc...' terminated by signal SIGBUS (Misaligned address error)
hassila@ice ~/g/ordo (main) [SIGBUS]> sudo swift-inspect dump-concurrency 62326
TASKS
fish: Job 1, 'sudo swift-inspect dump-concu...' terminated by signal SIGBUS (Misaligned address error)
hassila@ice ~/g/ordo (main) [SIGBUS]> 

```

---

<div class="post-metadata">

**Author:** ![wes1](https://avatars.discourse-cdn.com/v4/letter/w/848f3c/32.png) [@wes1](https://forums.swift.org/u/wes1)\
**Post date:** [March 26, 2024, 6:42pm UTC](https://forums.swift.org/t/how-do-i-get-swift-inspect-to-work-on-macos/70648/22 "2024-03-26T18:42:25Z")

</div>

FWIW, I'm not crashing in concurrency or arrays and get no runtime warnings (but skip 3 commands d/t `metadata allocation iteration`). It's likely my app is too simple async-wise to trigger the crash.

- `swift-inspect`: self-signed per workaround
- target app: running under Xcode debugger, but in sandbox.
- XCode: 15.3
- macOS: 14.4
- mac: studio M1 max

```swift
## swift-inspect dump-conformance-cache from({item})
Conformance: Swift.Bool: Swift._ObjectiveCBridgeable
[...]

## swift-inspect dump-raw-metadata from({item})
- SKIP: must enable `metadata allocation iteration`

## swift-inspect dump-generic-metadata from({item})
- SKIP: must enable `metadata allocation iteration`

## swift-inspect dump-cache-nodes from({item})
- SKIP: must enable `metadata allocation iteration`

## swift-inspect dump-arrays from({item})
Address	Size	Count	Is Class
0x600000e03810	208	1	false
0x600000e039b0	208	1	false
[...]

## swift-inspect dump-concurrency from({item})
TASKS
        
      Task 0x1 - flags=future enqueuePriority=0x19 maxPriority=0x0 address=0x13b127990
        async backtrace: NSNotificationCenter.Notifications.next() [...]
        resume function: NSNotificationCenter.Notifications.next() in Foundation
        task allocator: 1016 bytes in 2 chunks

ACTORS
THREADS
  no threads with active tasks

```

---

<div class="post-metadata">

**Author:** ![al45tair](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/al45tair/32/17985_2.png) [@al45tair](https://forums.swift.org/u/al45tair)\
**Post date:** [March 26, 2024, 9:34pm UTC](https://forums.swift.org/t/how-do-i-get-swift-inspect-to-work-on-macos/70648/23 "2024-03-26T21:34:54Z")

</div>

Ok, if that’s still crashing then I think that’s probably a bug of some sort. If you could file a GitHub Issue or a Feedback Request and attach the crash logs, that’d be much appreciated.

---

<div class="post-metadata">

**Author:** ![eskimo](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/eskimo/32/13558_2.png) [@eskimo](https://forums.swift.org/u/eskimo)\
**Post date:** [March 27, 2024, 9:25am UTC](https://forums.swift.org/t/how-do-i-get-swift-inspect-to-work-on-macos/70648/24 "2024-03-27T09:25:30Z")

</div>

hassila already filed this as FB13694901 [1].

Share and Enjoy

Quinn “The Eskimo!” @ DTS @ Apple

[1] al45tair already knows this. I believe that request is a classic example of a race condition (-:

---

<div class="post-metadata">

**Author:** ![hassila](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/hassila/32/22647_2.png) [@hassila](https://forums.swift.org/u/hassila)\
**Post date:** [March 27, 2024, 4:09pm UTC](https://forums.swift.org/t/how-do-i-get-swift-inspect-to-work-on-macos/70648/25 "2024-03-27T16:09:09Z")

</div>

Thanks @eskimo and @al45tair - I did update the FB with the two different crashes for array/concurrency. For anyone interested the offending stack is:

```swift
Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_platform.dylib 0x19dfb335c _platform_memmove + 444
1 libswiftRemoteMirror.dylib 0x10473b938 swift::remote::MemoryReader::readBytes(swift::remote::RemoteAddress, unsigned char*, unsigned long long) + 100
2 libswiftRemoteMirror.dylib 0x10475b348 swift::remote::MetadataReader<swift::External<swift::WithObjCInterop<swift::RuntimeTarget<8u>>>, swift::reflection::TypeRefBuilder>::readObjCRODataPtr(unsigned long long) + 156
3 libswiftRemoteMirror.dylib 0x1047558b4 swift::remote::MetadataReader<swift::External<swift::WithObjCInterop<swift::RuntimeTarget<8u>>>, swift::reflection::TypeRefBuilder>::readNominalTypeFromClassMetadata(swift::remote::RemoteRef<swift::TargetMetadata<swift::External<swift::WithObjCInterop<swift::RuntimeTarget<8u>>>> const>, int, bool) + 124
4 libswiftRemoteMirror.dylib 0x1047351cc swift::remote::MetadataReader<swift::External<swift::WithObjCInterop<swift::RuntimeTarget<8u>>>, swift::reflection::TypeRefBuilder>::readTypeFromMetadata(unsigned long long, bool, int) + 1112
5 swift-inspect 0x104017b68 0x10400c000 + 47976
6 swift-inspect 0x1040212c8 0x10400c000 + 86728
7 swift-inspect 0x1040212a0 0x10400c000 + 86688
8 swift-inspect 0x10401abcc 0x10400c000 + 60364
9 libsystem_malloc.dylib 0x19ddb54c8 nanov2_ptr_in_use_enumerator + 1256
10 Symbolication 0x1dfe7c4b4 VMUTask_foreach_malloc_zone + 3476
11 Symbolication 0x1dfe7b6f4 task_foreach_malloc_zone + 72
12 Symbolication 0x1dfe7c910 task_enumerate_malloc_blocks + 100
13 swift-inspect 0x104017a80 0x10400c000 + 47744
14 swift-inspect 0x104014b34 0x10400c000 + 35636
15 swift-inspect 0x1040149cc 0x10400c000 + 35276
16 swift-inspect 0x1040181b0 0x10400c000 + 49584
17 swift-inspect 0x104015884 0x10400c000 + 39044
18 dyld 0x19dbfa0e0 start + 2360

```

```swift

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libsystem_platform.dylib 0x19dfb3344 _platform_memmove + 420
1 libswiftRemoteMirror.dylib 0x105673938 swift::remote::MemoryReader::readBytes(swift::remote::RemoteAddress, unsigned char*, unsigned long long) + 100
2 libswiftRemoteMirror.dylib 0x10568d50c swift::remote::MetadataReader<swift::External<swift::WithObjCInterop<swift::RuntimeTarget<8u>>>, swift::reflection::TypeRefBuilder>::readMetadata(unsigned long long) + 256
3 libswiftRemoteMirror.dylib 0x10566e440 swift::reflection::ReflectionContext<swift::External<swift::WithObjCInterop<swift::RuntimeTarget<8u>>>>::metadataIsActor(unsigned long long) + 32
4 libswiftRemoteMirror.dylib 0x10566e418 swift_reflection_metadataIsActor + 20
5 swift-inspect 0x104f5b01c 0x104f44000 + 94236
6 swift-inspect 0x104f5a404 0x104f44000 + 91140
7 swift-inspect 0x104f64b40 0x104f44000 + 133952
8 swift-inspect 0x104f64ba8 0x104f44000 + 134056
9 swift-inspect 0x104f52bcc 0x104f44000 + 60364
10 libsystem_malloc.dylib 0x19ddb54c8 nanov2_ptr_in_use_enumerator + 1256
11 Symbolication 0x1dfe7c4b4 VMUTask_foreach_malloc_zone + 3476
12 Symbolication 0x1dfe7b6f4 task_foreach_malloc_zone + 72
13 Symbolication 0x1dfe7c910 task_enumerate_malloc_blocks + 100
14 swift-inspect 0x104f59dc4 0x104f44000 + 89540
15 swift-inspect 0x104f5a5e8 0x104f44000 + 91624
16 swift-inspect 0x104f5a1c0 0x104f44000 + 90560
17 swift-inspect 0x104f5c2f8 0x104f44000 + 99064
18 swift-inspect 0x104f4ce5c 0x104f44000 + 36444
19 swift-inspect 0x104f59b18 0x104f44000 + 88856
20 swift-inspect 0x104f4d884 0x104f44000 + 39044
21 dyld 0x19dbfa0e0 start + 2360

```

---

<div class="post-metadata">

**Author:** ![al45tair](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/al45tair/32/17985_2.png) [@al45tair](https://forums.swift.org/u/al45tair)\
**Post date:** [March 27, 2024, 4:20pm UTC](https://forums.swift.org/t/how-do-i-get-swift-inspect-to-work-on-macos/70648/26 "2024-03-27T16:20:09Z")

</div>

Thank-you :-) Much appreciated.

---

<div class="post-metadata">

**Author:** ![hitesh.savaliya](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/hitesh.savaliya/32/39523_2.png) [@hitesh.savaliya](https://forums.swift.org/u/hitesh.savaliya)\
**Post date:** [April 25, 2025, 4:06pm UTC](https://forums.swift.org/t/how-do-i-get-swift-inspect-to-work-on-macos/70648/27 "2025-04-25T16:06:03Z")

</div>

I'm wondering if anyone managed to get this work on MacOS (Swift + SwiftUI)?  
Thank you.

---

<div class="post-metadata">

**Author:** ![hassila](https://sea2.discourse-cdn.com/swift/user_avatar/forums.swift.org/hassila/32/22647_2.png) [@hassila](https://forums.swift.org/u/hassila)\
**Post date:** [April 25, 2025, 4:39pm UTC](https://forums.swift.org/t/how-do-i-get-swift-inspect-to-work-on-macos/70648/28 "2025-04-25T16:39:41Z")

</div>

Nope, unfortunately not - was a while since I tried last though.

[Previous page](https://forums.swift.org/t/how-do-i-get-swift-inspect-to-work-on-macos/70648.md?page=1)
