Module: OS::Mac::DevelopmentTools Private

Extended by:
T::Helpers
Defined in:
extend/os/mac/development_tools.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.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.ld64_versionVersion

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.

Returns:



40
41
42
43
44
45
46
47
48
49
# File 'extend/os/mac/development_tools.rb', line 40

def self.ld64_version
  @ld64_version ||= T.let(begin
    json = Utils.popen_read("/usr/bin/ld", "-version_details")
    if $CHILD_STATUS.success?
      Version.parse(JSON.parse(json)["version"])
    else
      Version::NULL
    end
  end, T.nilable(Version))
end

Instance Method Details

#build_system_infoHash{String => String, nil}

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.

Returns:



79
80
81
82
83
84
85
86
# File 'extend/os/mac/development_tools.rb', line 79

def build_system_info
  build_info = {
    "xcode"          => MacOS::Xcode.version.to_s.presence,
    "clt"            => MacOS::CLT.version.to_s.presence,
    "preferred_perl" => MacOS.preferred_perl_version,
  }
  super.merge build_info
end

#curl_handles_most_https_certificates?Boolean

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.

Returns:

  • (Boolean)


52
53
54
55
56
# File 'extend/os/mac/development_tools.rb', line 52

def curl_handles_most_https_certificates?
  # The system Curl is too old for some modern HTTPS certificates on
  # older macOS versions.
  ENV["HOMEBREW_SYSTEM_CURL_TOO_OLD"].nil?
end

#custom_installation_instructionsString

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.

Returns:



71
72
73
74
75
76
# File 'extend/os/mac/development_tools.rb', line 71

def custom_installation_instructions
  <<~EOS
    Install GNU's GCC:
      brew install gcc
  EOS
end

#default_compilerSymbol

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.

Returns:



35
36
37
# File 'extend/os/mac/development_tools.rb', line 35

def default_compiler
  :clang
end

#installation_instructionsString

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.

Returns:



66
67
68
# File 'extend/os/mac/development_tools.rb', line 66

def installation_instructions
  MacOS::CLT.installation_instructions
end

#installed?Boolean

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.

Checks if the user has any developer tools installed, either via Xcode or the CLT. Convenient for guarding against formula builds when building is impossible.

Returns:

  • (Boolean)


30
31
32
# File 'extend/os/mac/development_tools.rb', line 30

def installed?
  MacOS::Xcode.installed? || MacOS::CLT.installed?
end

#locate(tool) ⇒ Pathname?

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.

Parameters:

Returns:



14
15
16
17
18
19
20
21
22
23
24
# File 'extend/os/mac/development_tools.rb', line 14

def locate(tool)
  @locate ||= T.let({}, T.nilable(T::Hash[T.any(String, Symbol), Pathname]))
  @locate.fetch(tool) do |key|
    @locate[key] = if (located_tool = super(tool))
      located_tool
    else
      path = Utils.popen_read("/usr/bin/xcrun", "-no-cache", "-find", tool, err: :close).chomp
      Pathname.new(path) if File.executable?(path)
    end
  end
end

#subversion_handles_most_https_certificates?Boolean

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.

Returns:

  • (Boolean)


59
60
61
62
63
# File 'extend/os/mac/development_tools.rb', line 59

def subversion_handles_most_https_certificates?
  # The system Subversion is too old for some HTTPS certificates on
  # older macOS versions.
  MacOS.version >= :sierra
end