Module: OS Private

Defined in:
Library/Homebrew/os.rb,
Library/Homebrew/os/mac.rb,
Library/Homebrew/os/linux.rb,
Library/Homebrew/cask/macos.rb,
Library/Homebrew/os/mac/sdk.rb,
Library/Homebrew/os/mac/xcode.rb,
Library/Homebrew/os/linux/glibc.rb,
Library/Homebrew/os/mac/version.rb,
Library/Homebrew/os/mac/xquartz.rb,
Library/Homebrew/os/linux/kernel.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Helper functions for querying operating system information.

Defined Under Namespace

Modules: Linux, Mac

Constant Summary collapse

ISSUES_URL =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

"https://docs.brew.sh/Troubleshooting"
PATH_OPEN =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

"xdg-open"

Class Method Summary collapse

Class Method Details

.kernel_versionObject

Get the kernel version.


28
29
30
# File 'Library/Homebrew/os.rb', line 28

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

.linux?Boolean

Check if the operating system is Linux.

Returns:

  • (Boolean)

19
20
21
22
23
# File 'Library/Homebrew/os.rb', line 19

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

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

.mac?Boolean

Check if the operating system is macOS.

Returns:

  • (Boolean)

10
11
12
13
14
# File 'Library/Homebrew/os.rb', line 10

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

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