Getting the following error when importing Darwin or Foundation in Swift

I have gcc-11 installed from Homebrew, primarily so I can use gfortran. I don't have a math.h installed in /usr/local/include, which would seem to imply that gcc suite may not be the culprit, at least that version installed from Homebrew. Again, you might want to experiment by renaming math.h to something like math.h.orig in /usr/local/include and see if anything else goes haywire. If everything is OK, you've solved your problem. I would also check to make sure other standard C headers are also neutralized, headers like stdio.h, stdlib.h, limits.h, etc..

Moving /usr/local/include seems to fix it

Yay! And finally!

I encourage you to file a bug against the Swift REPL here. IMO it shouldn’t care about the contents of /usr/local/include, that is, it should be self-contained, just like Xcode.

Please post your bug number, just for the record.

Share and Enjoy

Quinn “The Eskimo!” @ DTS @ Apple

1 Like


The bug number is SR-15968 .

Thanks for your help.

1 Like