Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Running Swift build in Terminal leading to "Platform Path" errors

Tags:

xcode

swift

I recently reformatted my Mac. Today I tried building a swift executable via Terminal to start a server-side swift project. Here are the commands I've used:

  1. swift package init --type executable

  2. swift build

Upon running swift build, I got 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'm running Xcode 8.3.1.

Thanks in advance!

like image 718
Kelvin Lau Avatar asked Apr 14 '17 20:04

Kelvin Lau


1 Answers

Try fixing the SDK path (yours appears incorrect):

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

You might have this result:

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

Switch the default SDK location by invoking:

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

If that doesn't work then take a look inside the (normal) SDK path:

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

You should see the SDK's within that directory; if not you'll need to download them.

like image 63
l'L'l Avatar answered Oct 20 '22 14:10

l'L'l