Error Building Swift: Swift does not support the SDK 'MacOSX10.13.sdk'

Hi, I'm not entirely sure of the best category for this question, but here goes. I'm trying to build Swift via the instructions in the README, but after about an hour of building I get the following error.

:0: error: Swift does not support the SDK 'MacOSX10.13.sdk'
[811/1542] Linking CXX executable bin/sil-opt
ninja: build stopped: subcommand failed.
utils/build-script: fatal error: command terminated with a non-zero exit status 1, aborting

Do you have any suggestions on how to fix? I've got both Xcode 9.4 and Xcode 10 Beta installed, and have followed the instructions to the letter.

Thanks in advance!

Hi, Cary. You need to make sure the Xcode 10 beta is selected as your "Command Line Tools" version when you first configure the compiler build. You can check this under the "Locations" tab in the Xcode preferences.

Once you've configured once, the Xcode version you had selected will remain recorded in your build directory. Since it sounds like you have one that's using Xcode 9.4, you'll need to force a reconfigure. You can do that by deleting the Swift part of the build directory, or less destructively by just deleting the "CMakeCache.txt" file from within that folder. (It might still try to rebuild everything with the new Xcode's C compiler, though.)


Thank you Jordan! That's exactly what I needed to know.


This was my morning too. I deleted the build folder, did Xcode-select for the beta, and am trying a rebuild right now. I won't know for a few hours if it took.

This morning, before Jordan replied, I did the Xcode-select and that fixed it up. Though it took over an hour to find out, haha.

I'm glad to know there's a way to select it right from Xcode as well.

Good luck!

We need a better error message here.


You can also use --reconfigure. Make sure to use the same command you built with or it will create a new build directory.