Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Vapor Web Framework: error: Swift does not support the SDK 'MacOSX10.11.sdk'

When trying to build Vapor 0.13 (and likely other versions) w/ Swift 3 and Xcode

Environment

Vapor: 0.13
Swift: 3
Snapshot: DEVELOPMENT-SNAPSHOT-06-20-A
Xcode: 8

The following error is often the first result:

error: Swift does not support the SDK 'MacOSX10.11.sdk'

like image 338
Logan Avatar asked Jul 10 '16 20:07

Logan


1 Answers

NOTE: This is a Q&A Question that is being answered by the author.

This is an issue of having Xcode 7 already installed, and the latest snapshot being unable to run properly.

Execute the following steps

  1. Completely open Xcode 8 and install additional components as prompted
  2. Make sure you've downloaded DEVELOPMENT-SNAPSHOT-06-20-A here
  3. Run the following command

    sudo xcode-select -s /Applications/Xcode-beta.app/
    

    or go to Xcode preferences, then to the Locations tab and setting the "Command Line Tools" popup to Xcode 8.0.

    This will tell your system to use the Xcode-beta tools which support latest Swift

    Note: In above example, Xcode-beta is expected to be the name of your beta. If you change the names to something like Xcode-beta2, replace above. In occasional situations, users have had to do -s /Applications/Xcode-beta.app/Contents/Developer

  4. Return to your project and Verify that your project specifies Vapor 0.13, it will look like this:

    .Package(url: "https://github.com/qutheory/vapor.git", majorVersion: 0, minor: 13),
    
  5. Build your Xcode project

    swift package generate-xcodeproj
    
  6. Completely quit Xcode 7 if it is running

  7. Open Xcode project with open *.xcodeproj

  8. Verify the project was opened with Xcode 8

  9. Select toolchain Xcode > Toolchains > DEVELOPMENT-SNAPSHOT-06-20-A

  10. Run project 🚀

If you have any more questions, checkout the #help channel in our slack.

like image 51
Logan Avatar answered Oct 13 '22 06:10

Logan