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
+27-3Lines changed: 27 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -47,11 +47,35 @@ public struct MacOS: Platform {
47
47
}
48
48
49
49
publicfunc verifySystemPrerequisitesForInstall(
50
-
_:SwiftlyCoreContext, platformName _:String, version _:ToolchainVersion,
50
+
_ ctx:SwiftlyCoreContext, platformName _:String, version _:ToolchainVersion,
51
51
requireSignatureValidation _:Bool
52
52
)asyncthrows->String?{
53
-
// All system prerequisites should be there for macOS
54
-
nil
53
+
// Ensure that there is in fact a macOS SDK installed so the toolchain is usable.
54
+
letresult=tryawaitrun(
55
+
.path(SystemPackage.FilePath("/usr/bin/xcrun")),
56
+
arguments:["--show-sdk-path","--sdk","macosx"],
57
+
output:.string(limit:1024*10)
58
+
)
59
+
60
+
// Simply print warnings to the user stdout rather than returning a shell script, as there is not a simple
61
+
// shell script for installing developer tools on macOS.
62
+
if !result.terminationStatus.isSuccess {
63
+
await ctx.print("""
64
+
\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 Tools for Xcode:
65
+
xcode-select --install
66
+
67
+
More information on installing the Command Line Tools can be found here: https://developer.apple.com/documentation/xcode/installing-the-command-line-tools/#Install-the-Command-Line-Tools-package-in-Terminal. If developer tools are located at a non-default location on disk, use the following command to specify the Xcode that you wish to use for Command Line Tools for Xcode:
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