Running Swift build in Terminal causing platform path errors

I recently reformatted my Mac. Today I tried to create a quick executable file through Terminal to start a fast server project. Here are the commands I used:

  • fast init package --type executable

  • quick assembly

When running swift build I received the following errors:

 xcrun: error: unable to lookup item 'PlatformPath' from command line tools installation xcrun: error: unable to lookup item 'PlatformPath' in SDK '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk' 

I am running Xcode 8.3.1 .

Thanks in advance!

+7
source share
2 answers

Try fixing the SDK path (your invalid):

 $ xcrun --show-sdk-path --sdk macosx 

You may have this result:

 /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk 

Switch the default SDK location by calling:

 $ sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer 

If this does not work, look inside the (normal) SDK path:

 $ ls -lat /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/ 

You should see the SDK in this directory; if not, you will need to download them.

+24
source

Select the version of Xcode that can run the swift build , for example:

 sudo xcode-select -switch /Applications/Xcode-8.3.3.app 

Where Xcode-8.3.3 is the name of your Xcode application

-1
source

Source: https://habr.com/ru/post/1266743/


All Articles