Module: OS

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

typed: true frozen_string_literal: true

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.


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

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)

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

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)

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

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

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