Swift command line tool runtime crash dyld: Symbol not found: __pthread_atfork_child

When I build any swift command line tool it always crashes (

Thread 1: signal SIGABRT
) right after launch with:



dyld: Symbol not found: __pthread_atfork_child
 Referenced from: /usr/lib/libSystem.B.dylib
 Expected in: /usr/lib/libSystem.B.dylib
 in /usr/lib/libSystem.B.dylib 
Program ended with exit code: 9



This happens to any command line tool I build. Even when I build the xcode command line tool template.


Reseting the mac to an earlier time machine backup fixed the issue for a day. Then it came back for no reason.

However I am able to build command line tools using the swift cli and package manager.


I'm using Xcode 8 on macOS 10.12.5

Replies

Do you have Xcode configured to use a custom toolchain?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

I'm actually seeing this building my macOS app. The only change I made was updating the project to target 10.12 instead of 10.10. It happens on launch every time. I've cleaned build products and the build folder multiple times already. I'm also on Xcode 8 and macOS 10.12, and my project is mostly ObjC with some stuff in Swift. My Xcode is configured to use the default toolchain.


This Stack Overflow answer fixed it for me: https://stackoverflow.com/a/44707704/105717


I had to disable backtrace recording... for some reason...