`swift run` Server Error

When I try “swift run”, I get:
error: terminated(1): /usr/bin/xcrun --sdk macosx --show-sdk-platform-path output:
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’

For context, I’m running xcode version 14.3, and “swift --version” gives me:
Apple Swift version 5.8.1 (swiftlang-5.8.0.124.5 clang-1403.0.22.11.100)
Target: arm64-apple-darwin22.5.0

Any idea on solving the “swift run” error? I’m following the serverside swift with vapor book, version 3.
Thanks!

Hi,

I’m getting the following errors after “swift run”:

patvdp@MiniPat 00-book-server % rm -Rf .build
patvdp@MiniPat 00-book-server % swift run
Fetching GitHub - vapor/vapor: 💧 A server-side Swift HTTP web framework. from cache
warning: ‘vapor’: skipping cache due to an error: Couldn’t fetch updates from remote repositories:
Unknown option: -C
usage: git [–version] [–help] [-c name=value]
[–exec-path[=]] [–html-path] [–man-path] [–info-path]
[-p|–paginate|–no-pager] [–no-replace-objects] [–bare]
[–git-dir=] [–work-tree=] [–namespace=]
[]
Fetched GitHub - vapor/vapor: 💧 A server-side Swift HTTP web framework. (19.51s)
error: Couldn’t get the list of tags:
Unknown option: -C
usage: git [–version] [–help] [-c name=value]
[–exec-path[=]] [–html-path] [–man-path] [–info-path]
[-p|–paginate|–no-pager] [–no-replace-objects] [–bare]
[–git-dir=] [–work-tree=] [–namespace=]
[]

I’m running Ventura 13.5, Xcode 14.3.1.
Swift version:
swift-driver version: 1.75.2 Apple Swift version 5.8.1 (swiftlang-5.8.0.124.5 clang-1403.0.22.11.100)

Target: arm64-apple-macosx13.0

How can I fix this?
Thanks, Patrick

Hi Akin! there’s an answer in StackOverflow

it suggests trying this command to restore the correct path to the SDK:

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

I server run successfully but when I try to open the page this happens:

any help

Why these dependencies are there to read the book? Frustrating with error “fatalError”.

Hello,

I just started reading the book and trying to run the server.
I get these errors:


/Users/nsd/Desktop/mcon-materials/00-book-server/.build/checkouts/vapor/Sources/Vapor/HTTP/Server/HTTPServer.swift:380:54: error: reference to captured var 'application' in concurrently-executing code
                                        application: application!,
                                                     ^
/Users/nsd/Desktop/mcon-materials/00-book-server/.build/checkouts/vapor/Sources/Vapor/HTTP/Server/HTTPServer.swift:388:46: error: reference to captured var 'application' in concurrently-executing code
                                application: application!,
                                             ^

M1 Pro
macOS 14.2.1
Xcode 15.2

swift --version:

swift-driver version: 1.87.3 Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5)
Target: arm64-apple-macosx14.0
1 Like

I’ve managed to run it by changing Vapor version to the latest 4.92.1.

1 Like

I just updated the dependency in Package.swift to version 4.92.1 and indeed it is working now!
Nice, thank you very much!

PS: Maybe someone should update it in the repo’s latest branch as well :]

2 Likes

Yes, this is working solution.

Thanks to saik0u · GitHub for the PR updating vapor, this is merged and tagged as 2.0.1

1 Like