Module: OS::Mac::SystemConfig::ClassMethods Private
- Extended by:
- T::Helpers
- Defined in:
- extend/os/mac/system_config.rb
This module is part of a private API. This module may only be used in the Homebrew/brew repository. Third parties should avoid using this module if possible, as it may be removed or changed without warning.
Instance Method Summary collapse
- #clt ⇒ Version? private
- #config_sections ⇒ Array<Symbol> private
- #describe_clang ⇒ String private
- #initialize ⇒ void private
- #macos_config(out = $stdout) ⇒ void private
- #metal_toolchain ⇒ String? private
- #xcode ⇒ String? private
Instance Method Details
#clt ⇒ Version?
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
39 40 41 |
# File 'extend/os/mac/system_config.rb', line 39 def clt @clt ||= MacOS::CLT.version if MacOS::CLT.installed? end |
#config_sections ⇒ Array<Symbol>
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
72 73 74 |
# File 'extend/os/mac/system_config.rb', line 72 def config_sections super + [:macos_config] end |
#describe_clang ⇒ String
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
22 23 24 25 26 27 |
# File 'extend/os/mac/system_config.rb', line 22 def describe_clang return "N/A" if clang.null? clang_build_info = clang_build.null? ? "(parse error)" : clang_build "#{clang} build #{clang_build_info}" end |
#initialize ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
15 16 17 18 19 |
# File 'extend/os/mac/system_config.rb', line 15 def initialize super @xcode = T.let(nil, T.nilable(String)) @clt = T.let(nil, T.nilable(Version)) end |
#macos_config(out = $stdout) ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
This method returns an undefined value.
60 61 62 63 64 65 66 67 68 69 |
# File 'extend/os/mac/system_config.rb', line 60 def macos_config(out = $stdout) out.puts "macOS: #{MacOS.full_version}-#{kernel}" out.puts "CLT: #{clt || "N/A"}" out.puts "Xcode: #{xcode || "N/A"}" # Metal Toolchain is a separate install starting with Xcode 26. if ::Hardware::CPU.arm64? && MacOS::Xcode.installed? && MacOS::Xcode.version >= "26.0" out.puts "Metal Toolchain: #{ || "N/A"}" end out.puts "Rosetta 2: #{::Hardware::CPU.in_rosetta2?}" if ::Hardware::CPU.physical_cpu_arm64? end |
#metal_toolchain ⇒ String?
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 |
# File 'extend/os/mac/system_config.rb', line 44 def return unless ::Hardware::CPU.arm64? @metal_toolchain ||= T.let(nil, T.nilable(String)) @metal_toolchain ||= if MacOS::Xcode.installed? || MacOS::CLT.installed? result = SystemCommand.run("xcrun", args: ["--find", "metal"], print_stderr: false, print_stdout: false) pattern = /MetalToolchain-v(?<major>\d+)\.(?<letter>\d+)\.(?<build>\d+)\.(?<minor>\d+)/ if result.success? && (m = result.stdout.match(pattern)) letter = ("A".ord - 1 + m[:letter].to_i).chr "#{m[:major]}.#{m[:minor]} (#{m[:major]}#{letter}#{m[:build]})" end end end |
#xcode ⇒ String?
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
30 31 32 33 34 35 36 |
# File 'extend/os/mac/system_config.rb', line 30 def xcode @xcode ||= if MacOS::Xcode.installed? xcode = MacOS::Xcode.version.to_s xcode += " => #{MacOS::Xcode.prefix}" unless MacOS::Xcode.default_prefix? xcode end end |