Module: OS Private

Defined in:
extend/os/linux/keg.rb,
extend/os/mac/keg.rb,
extend/os/mac/cleaner.rb,
extend/os/mac/cleanup.rb,
extend/os/mac/formula.rb,
extend/os/mac/install.rb,
extend/os/mac/readall.rb,
extend/os/mac/sandbox.rb,
extend/os/linux/search.rb,
extend/os/mac/cask/dsl.rb,
extend/os/mac/hardware.rb,
extend/os/mac/test_bot.rb,
extend/os/linux/cleaner.rb,
extend/os/linux/cleanup.rb,
extend/os/linux/formula.rb,
extend/os/linux/install.rb,
extend/os/linux/sandbox.rb,
extend/os/mac/reinstall.rb,
extend/os/linux/test_bot.rb,
extend/os/mac/diagnostic.rb,
extend/os/linux/compilers.rb,
extend/os/mac/cask/config.rb,
extend/os/linux/diagnostic.rb,
extend/os/mac/api/internal.rb,
extend/os/mac/hardware/cpu.rb,
extend/os/mac/keg_relocate.rb,
extend/os/mac/utils/socket.rb,
extend/os/linux/cask/config.rb,
extend/os/mac/dev-cmd/tests.rb,
extend/os/mac/language/java.rb,
extend/os/mac/system_config.rb,
extend/os/mac/utils/bottles.rb,
extend/os/linux/hardware/cpu.rb,
extend/os/linux/keg_relocate.rb,
extend/os/mac/bundle/skipper.rb,
extend/os/mac/cask/installer.rb,
extend/os/mac/dev-cmd/bottle.rb,
extend/os/mac/extend/ENV/std.rb,
extend/os/linux/bundle/bundle.rb,
extend/os/linux/cask/caskroom.rb,
extend/os/linux/dev-cmd/tests.rb,
extend/os/linux/system_config.rb,
extend/os/mac/cask/quarantine.rb,
extend/os/mac/linkage_checker.rb,
extend/os/mac/missing_formula.rb,
extend/os/mac/simulate_system.rb,
extend/os/linux/bundle/skipper.rb,
extend/os/linux/cask/installer.rb,
extend/os/linux/dev-cmd/bottle.rb,
extend/os/linux/extend/ENV/std.rb,
extend/os/mac/cask/utils/trash.rb,
extend/os/mac/extend/ENV/super.rb,
extend/os/mac/utils/github/api.rb,
extend/os/linux/cask/quarantine.rb,
extend/os/linux/linkage_checker.rb,
extend/os/linux/simulate_system.rb,
extend/os/mac/development_tools.rb,
extend/os/mac/extend/ENV/shared.rb,
extend/os/mac/formula_installer.rb,
extend/os/linux/cask/utils/trash.rb,
extend/os/linux/extend/ENV/super.rb,
extend/os/mac/extend/pathname/os.rb,
extend/os/linux/development_tools.rb,
extend/os/linux/extend/ENV/shared.rb,
extend/os/linux/formula_installer.rb,
extend/os/mac/cask/artifact/moved.rb,
extend/os/linux/extend/pathname/os.rb,
extend/os/mac/dependency_collector.rb,
extend/os/linux/cask/artifact/moved.rb,
extend/os/linux/dev-cmd/update-test.rb,
extend/os/mac/formula_cellar_checks.rb,
extend/os/linux/bottle_specification.rb,
extend/os/linux/bundle/brew_services.rb,
extend/os/linux/dependency_collector.rb,
extend/os/linux/formula_cellar_checks.rb,
extend/os/mac/cask/artifact/relocated.rb,
extend/os/mac/cask/artifact/symlinked.rb,
extend/os/mac/requirements/macos_requirement.rb,
extend/os/mac/cask/artifact/abstract_uninstall.rb,
os.rb,
os/mac.rb,
os/linux.rb,
cask/macos.rb,
os/mac/ffi.rb,
os/mac/sdk.rb,
os/linux/ld.rb,
os/mac/xcode.rb,
os/issues_url.rb,
os/linux/glibc.rb,
os/linux/elf/os.rb,
os/linux/kernel.rb,
os/mac/ffi/dyld.rb,
os/mac/ffi/xattr.rb,
os/linux/libstdcxx.rb,
os/mac/ffi/app_kit.rb,
os/mac/ffi/libproc.rb,
os/mac/ffi/security.rb,
os/mac/ffi/foundation.rb,
os/mac/ffi/objective_c.rb,
os/third_party_homebrew.rb,
os/mac/ffi/native_library.rb,
os/mac/ffi/core_foundation.rb,
os/mac/ffi/launch_services.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.

Defined Under Namespace

Modules: Linux, Mac Classes: ThirdPartyHomebrew

Constant Summary collapse

LINUX_CI_OS_VERSION =

This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.

See Linux-CI.md

"Ubuntu 24.04"
LINUX_CI_ARM_RUNNER =

This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.

"ubuntu-24.04-arm"
LINUX_GLIBC_CI_VERSION =

This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.

"2.39"
LINUX_GLIBC_NEXT_CI_VERSION =

This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.

users below this version will be warned by brew doctor

"2.39"
LINUX_GCC_CI_VERSION =

This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.

https://packages.ubuntu.com/noble/gcc

"13"
LINUX_LIBSTDCXX_CI_VERSION =

This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.

https://packages.ubuntu.com/noble/libstdc++6

"6.0.33"
LINUX_PREFERRED_GCC_COMPILER_FORMULA =

This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.

T.let("gcc@#{LINUX_GCC_CI_VERSION}".freeze, String)
LINUX_PREFERRED_GCC_RUNTIME_FORMULA =

This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.

"gcc"
PATH_OPEN =

This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.

if wsl? && (wslview = which("wslview"))
  wslview.to_s
else
  "xdg-open"
end.freeze
ISSUES_URL =

This constant is part of a private API. This constant may only be used in the Homebrew/brew repository. Third parties should avoid using this constant if possible, as it may be removed or changed without warning.

T.let(issues_url.freeze, T.nilable(String))

Class Method Summary collapse

Class Method Details

.kernel_name ⇒ String

Get the kernel name.

Returns:



54
55
56
57
# File 'os.rb', line 54

def self.kernel_name
  require "etc"
  @kernel_name ||= T.let(Etc.uname.fetch(:sysname), T.nilable(String))
end

.kernel_version ⇒ Version

Get the kernel version.

Returns:



45
46
47
48
# File 'os.rb', line 45

def self.kernel_version
  require "etc"
  @kernel_version ||= Version.new(Etc.uname.fetch(:release))
end

.linux? ⇒ Boolean

Check whether the operating system is Linux.

Returns:

  • (Boolean)


25
26
27
28
29
# File 'os.rb', line 25

def self.linux?
  return false if ENV["HOMEBREW_TEST_GENERIC_OS"]

  RbConfig::CONFIG["host_os"].include? "linux"
end

.mac? ⇒ Boolean

Check whether the operating system is macOS.

Returns:

  • (Boolean)


15
16
17
18
19
# File 'os.rb', line 15

def self.mac?
  return false if ENV["HOMEBREW_TEST_GENERIC_OS"]

  RbConfig::CONFIG["host_os"].include? "darwin"
end

.not_tier_one_configuration? ⇒ 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)


108
109
110
111
112
113
# File 'os.rb', line 108

def self.not_tier_one_configuration?
  return true if third_party_homebrew? || ISSUES_URL.nil?

  require "diagnostic"
  Homebrew::Diagnostic.support_tier != 1
end

.third_party_homebrew ⇒ ThirdPartyHomebrew?

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.

Detect the third-party configuration once, when support guidance is needed.

Returns:



73
74
75
76
77
78
# File 'os.rb', line 73

def self.third_party_homebrew
  return @third_party_homebrew if defined?(@third_party_homebrew)
  return if !mac? && !linux?

  @third_party_homebrew = T.let(ThirdPartyHomebrew.detect(macos: mac?), T.nilable(ThirdPartyHomebrew))
end

.third_party_homebrew? ⇒ 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)


81
82
83
# File 'os.rb', line 81

def self.third_party_homebrew?
  !third_party_homebrew.nil?
end

.wsl? ⇒ Boolean

Check whether the operating system is Linux on windows (WSL).

Returns:

  • (Boolean)


35
36
37
38
39
# File 'os.rb', line 35

def self.wsl?
  return false if ENV["HOMEBREW_TEST_GENERIC_OS"]

  /-microsoft/i.match?(kernel_version.to_s)
end