You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: Sources/MacOSPlatform/MacOS.swift
+25-3Lines changed: 25 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -48,11 +48,33 @@ public struct MacOS: Platform {
48
48
}
49
49
50
50
publicfunc verifySystemPrerequisitesForInstall(
51
-
_:SwiftlyCoreContext, platformName _:String, version _:ToolchainVersion,
51
+
_ ctx:SwiftlyCoreContext, platformName _:String, version _:ToolchainVersion,
52
52
requireSignatureValidation _:Bool
53
53
)asyncthrows->String?{
54
-
// All system prerequisites should be there for macOS
55
-
nil
54
+
// Ensure that there is in fact a macOS SDK installed so the toolchain is usable.
55
+
letresult=tryawaitrun(
56
+
.path(SystemPackage.FilePath("/usr/bin/xcrun")),
57
+
arguments:["--show-sdk-path","--sdk","macosx"],
58
+
output:.string(limit:1024*10)
59
+
)
60
+
61
+
// Simply print warnings to the user stdout rather than returning a shell script, as there is not a simple
62
+
// shell script for installing developer tools on macOS.
63
+
if !result.terminationStatus.isSuccess {
64
+
await ctx.print("""
65
+
\nWARNING: Could not find a macOS SDK on the system. A macOS SDK is required for the toolchain to work correctly. Please install one via Xcode (https://developer.apple.com/xcode) or run the following command on your machine to install the command line developer tools: `xcode-select --install`.
66
+
67
+
If developer tools are located at a non-default location on disk, use `sudo xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools.\n
await ctx.print("WARNING: Could not read output of '/usr/bin/xcrun --show-sdk-path --sdk macosx'. Ensure your macOS SDK is installed properly for the swift toolchain to work.")
0 commit comments