Module: OS Private

Defined in:
os.rb,
os/mac.rb,
os/linux.rb,
cask/macos.rb,
os/mac/sdk.rb,
os/linux/ld.rb,
os/linux/elf.rb,
os/mac/xcode.rb,
macos_version.rb,
os/linux/glibc.rb,
os/linux/kernel.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

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 22.04"
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.35"
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.

"2.35"
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.

"11.0"
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.

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

"gcc@11"
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"
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.

"https://docs.brew.sh/Troubleshooting"
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 OS::Linux.wsl? && (wslview = which("wslview").presence)
  wslview.to_s
else
  "xdg-open"
end.freeze

Class Method Summary collapse

Class Method Details

.kernel_nameString

Get the kernel name.

Returns:



40
41
42
# File 'os.rb', line 40

def self.kernel_name
  @kernel_name ||= Utils.safe_popen_read("uname", "-s").chomp
end

.kernel_versionVersion

Get the kernel version.

Returns:



32
33
34
# File 'os.rb', line 32

def self.kernel_version
  @kernel_version ||= Version.new(Utils.safe_popen_read("uname", "-r").chomp)
end

.linux?Boolean

Check whether the operating system is Linux.

Returns:

  • (Boolean)


22
23
24
25
26
# File 'os.rb', line 22

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)


12
13
14
15
16
# File 'os.rb', line 12

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

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

.unsupported_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)


77
78
79
# File 'os.rb', line 77

def self.unsupported_configuration?
  !defined?(OS::ISSUES_URL)
end