Module: Homebrew Private

Extended by:
Context, Utils::Output::Mixin
Defined in:
extend/os/mac/pkgconf.rb,
extend/os/linux/cmd/update-report.rb,
api.rb,
ask.rb,
bump.rb,
help.rb,
fetch.rb,
style.rb,
trust.rb,
vulns.rb,
bundle.rb,
global.rb,
search.rb,
unlink.rb,
api/env.rb,
cleanup.rb,
cmd/log.rb,
cmd/pin.rb,
cmd/tab.rb,
cmd/tap.rb,
install.rb,
missing.rb,
service.rb,
upgrade.rb,
api/cask.rb,
cli/args.rb,
cmd/deps.rb,
cmd/desc.rb,
cmd/docs.rb,
cmd/exec.rb,
cmd/help.rb,
cmd/home.rb,
cmd/info.rb,
cmd/link.rb,
cmd/list.rb,
cmd/uses.rb,
homebrew.rb,
manpages.rb,
settings.rb,
test_bot.rb,
cli/error.rb,
cmd/--env.rb,
cmd/alias.rb,
cmd/casks.rb,
cmd/fetch.rb,
cmd/trust.rb,
cmd/unpin.rb,
cmd/untap.rb,
cmd/vulns.rb,
uninstall.rb,
vulns/osv.rb,
bundle/dsl.rb,
bundle/tap.rb,
cli/parser.rb,
cmd/--taps.rb,
cmd/bundle.rb,
cmd/config.rb,
cmd/doctor.rb,
cmd/leaves.rb,
cmd/search.rb,
cmd/source.rb,
cmd/unlink.rb,
cmd/update.rb,
dev-cmd/sh.rb,
diagnostic.rb,
env_config.rb,
mcp_server.rb,
vulns/cvss.rb,
vulns/purl.rb,
api/formula.rb,
attestation.rb,
bundle/brew.rb,
bundle/cask.rb,
cmd/--cache.rb,
cmd/cleanup.rb,
cmd/command.rb,
cmd/install.rb,
cmd/migrate.rb,
cmd/missing.rb,
cmd/options.rb,
cmd/readall.rb,
cmd/unalias.rb,
cmd/untrust.rb,
cmd/upgrade.rb,
completions.rb,
dev-cmd/cat.rb,
dev-cmd/irb.rb,
tap_auditor.rb,
vulns/match.rb,
api/internal.rb,
bundle/adder.rb,
bundle/trust.rb,
cmd/--cellar.rb,
cmd/--prefix.rb,
cmd/commands.rb,
cmd/formulae.rb,
cmd/outdated.rb,
cmd/services.rb,
cmd/shellenv.rb,
cmd/tap-info.rb,
dev-cmd/bump.rb,
dev-cmd/edit.rb,
dev-cmd/lgtm.rb,
dev-cmd/prof.rb,
dev-cmd/ruby.rb,
dev-cmd/test.rb,
services/cli.rb,
vulns/output.rb,
vulns/semver.rb,
aliases/alias.rb,
api/analytics.rb,
bundle/dumper.rb,
bundle/lister.rb,
cmd/--version.rb,
cmd/analytics.rb,
cmd/developer.rb,
cmd/gist-logs.rb,
cmd/reinstall.rb,
cmd/uninstall.rb,
dev-cmd/audit.rb,
dev-cmd/style.rb,
dev-cmd/tests.rb,
install/check.rb,
install_steps.rb,
shell_command.rb,
test_bot/step.rb,
test_bot/test.rb,
vulns/history.rb,
vulns/scanner.rb,
bundle/checker.rb,
bundle/remover.rb,
bundle/skipper.rb,
bundle_version.rb,
cli/named_args.rb,
cmd/--caskroom.rb,
cmd/autoremove.rb,
cmd/mcp-server.rb,
cmd/pyenv-sync.rb,
cmd/rbenv-sync.rb,
cmd/setup-ruby.rb,
dev-cmd/bottle.rb,
dev-cmd/create.rb,
dev-cmd/unpack.rb,
dev-cmd/verify.rb,
download_queue.rb,
executables_db.rb,
test_bot/junit.rb,
test_bot/setup.rb,
vulns/cpan_sec.rb,
vulns/identify.rb,
vulns/repology.rb,
aliases/aliases.rb,
api/cask_struct.rb,
bundle/brewfile.rb,
cmd/completions.rb,
cmd/nodenv-sync.rb,
cmd/postinstall.rb,
dev-cmd/cask-ci.rb,
dev-cmd/extract.rb,
dev-cmd/formula.rb,
dev-cmd/linkage.rb,
dev-cmd/pr-pull.rb,
dev-cmd/release.rb,
dev-cmd/rubocop.rb,
dev-cmd/rubydoc.rb,
dev-cmd/tap-new.rb,
formula_auditor.rb,
formula_creator.rb,
livecheck/error.rb,
minimum_version.rb,
missing_formula.rb,
services/system.rb,
simulate_system.rb,
source_location.rb,
standalone/init.rb,
abstract_command.rb,
bundle/installer.rb,
cmd/--repository.rb,
cmd/sandbox-exec.rb,
cmd/update-reset.rb,
dev-cmd/debugger.rb,
dev-cmd/test-bot.rb,
release_cooldown.rb,
resource_auditor.rb,
startup/bootsnap.rb,
vulns/osv_export.rb,
api/cask_download.rb,
api/json_download.rb,
bundle/subcommand.rb,
cmd/update-report.rb,
cmd/which-formula.rb,
dev-cmd/benchmark.rb,
dev-cmd/livecheck.rb,
dev-cmd/pr-upload.rb,
dev-cmd/typecheck.rb,
dev-cmd/unbottled.rb,
formula_free_port.rb,
livecheck/options.rb,
services/formulae.rb,
test_bot/formulae.rb,
vulns/cached_feed.rb,
api/formula_bottle.rb,
api/formula_struct.rb,
api/packages_index.rb,
cmd/vendor-install.rb,
dev-cmd/pr-publish.rb,
diagnostic/finding.rb,
formula_assertions.rb,
livecheck/strategy.rb,
retryable_download.rb,
abstract_subcommand.rb,
api/source_download.rb,
bump_version_parser.rb,
bundle/package_type.rb,
cmd/as-console-user.rb,
cmd/version-install.rb,
dev-cmd/update-test.rb,
dev-cmd/vendor-gems.rb,
livecheck/constants.rb,
livecheck/livecheck.rb,
livecheck/strategic.rb,
reinstall/reinstall.rb,
services/subcommand.rb,
test_bot/tap_syntax.rb,
utils/phase_timings.rb,
vulns/vulnerability.rb,
analytics/subcommand.rb,
bundle/brew_services.rb,
bundle/extensions/go.rb,
bundle/extensions/uv.rb,
bundle/subcommand/sh.rb,
cmd/update-if-needed.rb,
dev-cmd/bump-cask-pr.rb,
dev-cmd/find-appcast.rb,
dev-cmd/generate-zap.rb,
dev-cmd/pr-automerge.rb,
dev-cmd/which-update.rb,
developer/subcommand.rb,
manpages/parser/ronn.rb,
sorbet/tapioca/utils.rb,
test_bot/test_runner.rb,
bundle/extensions/npm.rb,
bundle/subcommand/add.rb,
bundle/subcommand/env.rb,
dev-cmd/bump-revision.rb,
dev-cmd/contributions.rb,
package_manager_cache.rb,
test_bot/test_cleanup.rb,
bundle/extensions/krew.rb,
bundle/subcommand/dump.rb,
bundle/subcommand/edit.rb,
bundle/subcommand/exec.rb,
bundle/subcommand/list.rb,
completions/subcommand.rb,
dev-cmd/advisory-match.rb,
livecheck/strategy/git.rb,
livecheck/strategy/gnu.rb,
livecheck/strategy/npm.rb,
livecheck/strategy/xml.rb,
test_bot/bottles_fetch.rb,
test_bot/cleanup_after.rb,
test_bot/test_formulae.rb,
analytics/subcommand/on.rb,
bundle/extensions/cargo.rb,
bundle/subcommand/check.rb,
dev-cmd/bump-formula-pr.rb,
dev-cmd/update-sponsors.rb,
developer/subcommand/on.rb,
livecheck/strategy/cpan.rb,
livecheck/strategy/json.rb,
livecheck/strategy/pypi.rb,
livecheck/strategy/xorg.rb,
livecheck/strategy/yaml.rb,
manpages/converter/roff.rb,
prof/vernier_fork_guard.rb,
services/subcommand/run.rb,
test_bot/cleanup_before.rb,
vulns/advisory_database.rb,
analytics/subcommand/off.rb,
bundle/extensions/winget.rb,
bundle/subcommand/remove.rb,
developer/subcommand/off.rb,
livecheck/strategy/crate.rb,
livecheck/strategy/gnome.rb,
services/formula_wrapper.rb,
services/subcommand/info.rb,
services/subcommand/kill.rb,
services/subcommand/list.rb,
services/subcommand/stop.rb,
test_bot/formulae_detect.rb,
unversioned_cask_checker.rb,
vulns/advisory_overrides.rb,
bundle/extensions/flatpak.rb,
bundle/subcommand/cleanup.rb,
bundle/subcommand/install.rb,
bundle/subcommand_context.rb,
dev-cmd/formula-analytics.rb,
dev-cmd/generate-cask-api.rb,
livecheck/skip_conditions.rb,
livecheck/strategy/apache.rb,
services/subcommand/start.rb,
services/system/systemctl.rb,
analytics/subcommand/state.rb,
cmd/command-not-found-init.rb,
dev-cmd/update-maintainers.rb,
developer/subcommand/state.rb,
livecheck/strategy/hackage.rb,
livecheck/strategy/sparkle.rb,
bundle/extensions/extension.rb,
completions/subcommand/link.rb,
dev-cmd/generate-cask-token.rb,
dev-cmd/update-license-data.rb,
livecheck/livecheck_version.rb,
manpages/converter/kramdown.rb,
services/subcommand/cleanup.rb,
services/subcommand/restart.rb,
completions/subcommand/state.rb,
dev-cmd/generate-formula-api.rb,
dev-cmd/install-bundler-gems.rb,
dev-cmd/update-portable-ruby.rb,
livecheck/strategy/bitbucket.rb,
livecheck/strategy/launchpad.rb,
livecheck/strategy/ruby_gems.rb,
test_bot/formulae_dependents.rb,
completions/subcommand/unlink.rb,
dev-cmd/dispatch-build-bottle.rb,
dev-cmd/generate-internal-api.rb,
dev-cmd/update-perl-resources.rb,
install_steps/formula_actions.rb,
livecheck/strategy/page_match.rb,
api/cask/cask_struct_generator.rb,
dev-cmd/bump-unversioned-casks.rb,
dev-cmd/determine-test-runners.rb,
dev-cmd/generate-analytics-api.rb,
livecheck/strategy/sourceforge.rb,
bundle/extensions/mac_app_store.rb,
dev-cmd/generate-advisories-api.rb,
dev-cmd/generate-cask-ci-matrix.rb,
dev-cmd/update-python-resources.rb,
formula_name_cask_token_auditor.rb,
livecheck/strategy/header_match.rb,
dev-cmd/bump-python-resources-pr.rb,
dev-cmd/formula-python-resources.rb,
dev-cmd/generate-man-completions.rb,
livecheck/strategy/extract_plist.rb,
livecheck/strategy/github_latest.rb,
dev-cmd/generate-bottle-ci-matrix.rb,
dev-cmd/generate-vulns-advisories.rb,
bundle/extensions/vscode_extension.rb,
dev-cmd/bump-compatibility-version.rb,
livecheck/strategy/github_releases.rb,
livecheck/strategy/electron_builder.rb,
api/formula/formula_struct_generator.rb,
test_bot.rbi,
utils/gem_setup.rbi,
startup/bootsnap.rbi

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: API, Aliases, Ask, Assertions, Attestation, Bootsnap, Bump, Bundle, CLI, Cmd, Completions, DevCmd, Diagnostic, EnvConfig, FastBootRequire, Fetch, FreePort, Help, Install, InstallSteps, Livecheck, Manpages, MinimumVersion, Missing, MissingFormula, PackageManagerCache, PhaseTimings, Pkgconf, Reinstall, Search, Services, Settings, ShellCommand, Style, Tapioca, TestBot, Trust, Uninstall, Unlink, Upgrade, VernierForkGuard, Vulns Classes: AbstractCommand, AbstractSubcommand, BumpVersionParser, BundleVersion, CancelledDownloadError, Cleanup, DownloadQueue, ExecutablesDB, FormulaAuditor, FormulaCreator, FormulaNameCaskTokenAuditor, InsecureTrustStoreError, McpServer, ResourceAuditor, RetryableDownload, Service, SimulateSystem, SourceLocation, TapAuditor, UntrustedTapError, UnversionedCaskChecker

Constant Summary collapse

DEFAULT_PREFIX =

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(ENV.fetch("HOMEBREW_DEFAULT_PREFIX").freeze, String)
DEFAULT_REPOSITORY =

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(ENV.fetch("HOMEBREW_DEFAULT_REPOSITORY").freeze, String)
DEFAULT_CELLAR =

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("#{DEFAULT_PREFIX}/Cellar".freeze, String)
DEFAULT_MACOS_CELLAR =

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("#{HOMEBREW_DEFAULT_PREFIX}/Cellar".freeze, String)
DEFAULT_MACOS_ARM_CELLAR =

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("#{HOMEBREW_MACOS_ARM_DEFAULT_PREFIX}/Cellar".freeze, String)
DEFAULT_LINUX_CELLAR =

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("#{HOMEBREW_LINUX_DEFAULT_PREFIX}/Cellar".freeze, String)
MACOS_ARM64_BOTTLE_PREFIX =

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.

A pinned bottle built at one of these 64-byte prefixes can be patched for any shorter prefix.

T.let("/opt/homebrew/.brew-padded-arm64".ljust(64, "_").freeze, String)
LINUX_ARM64_BOTTLE_PREFIX =

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("/home/linuxbrew/.linuxbrew/.brew-padded-arm64".ljust(64, "_").freeze, String)
LINUX_X86_64_BOTTLE_PREFIX =

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("/home/linuxbrew/.linuxbrew/.brew-padded-x86_64".ljust(64, "_").freeze, String)
RELEASE_COOLDOWN_DAYS =

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.

1

Class Attribute Summary collapse

Class Method Summary collapse

Methods included from Context

current, current=, debug?, deferred_environment_expansion?, quiet?, verbose?, with_context

Methods included from Utils::Output::Mixin

issue_reporting_message, odebug, odeprecated, odie, odisabled, ofail, oh1, oh1_title, ohai, ohai_title, onoe, opoo, opoo_outside_github_actions, opoo_without_github_actions_annotation, pretty_cannot_install, pretty_deprecated, pretty_disabled, pretty_duration, pretty_install_status, pretty_installed, pretty_uninstalled, pretty_unmarked, pretty_upgradable, pretty_warning

Class Attribute Details

.auditing=(value) ⇒ Boolean (writeonly)

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)


76
77
78
# File 'global.rb', line 76

def auditing=(value)
  @auditing = value
end

.failed=(value) ⇒ Boolean (writeonly)

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)


70
71
72
# File 'global.rb', line 70

def failed=(value)
  @failed = value
end

.raise_deprecation_exceptions=(value) ⇒ Boolean (writeonly)

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)


73
74
75
# File 'global.rb', line 73

def raise_deprecation_exceptions=(value)
  @raise_deprecation_exceptions = value
end

Class Method Details

.auditing?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)


104
105
106
107
# File 'global.rb', line 104

def auditing?
  @auditing = T.let(@auditing, T.nilable(T::Boolean))
  @auditing == true
end

.auto_update_command?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)


126
127
128
# File 'global.rb', line 126

def auto_update_command?
  ENV.fetch("HOMEBREW_AUTO_UPDATE_COMMAND", false).present?
end

.default_prefix?(prefix = HOMEBREW_PREFIX) ⇒ Boolean

This method is part of an internal API. This method may only be used internally in repositories owned by Homebrew, except in casks or formulae. Third parties should avoid using this method if possible, as it may be removed or changed without warning.

Check whether Homebrew is using the default prefix.

Parameters:

Returns:

  • (Boolean)


82
83
84
# File 'global.rb', line 82

def default_prefix?(prefix = HOMEBREW_PREFIX)
  prefix.to_s == DEFAULT_PREFIX
end

.failed?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)


87
88
89
90
# File 'global.rb', line 87

def failed?
  @failed ||= T.let(false, T.nilable(T::Boolean))
  @failed == true
end

.messagesMessages

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:



93
94
95
# File 'global.rb', line 93

def messages
  @messages ||= T.let(Messages.new, T.nilable(Messages))
end

.migrate_gcc_dependents_if_neededvoid

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.

This method returns an undefined value.



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'extend/os/linux/cmd/update-report.rb', line 13

def migrate_gcc_dependents_if_needed
  return if Settings.read("gcc-rpaths.fixed") == "true"

  Formula.installed.each do |formula|
    next unless formula.tap&.core_tap?

    recursive_runtime_dependencies = Dependency.expand(
      formula,
      cache_key: "update-report",
    ) do |_, dependency|
      next Dependable::PRUNE if dependency.build? || dependency.test?
    end
    next unless recursive_runtime_dependencies.map(&:name).include? "gcc"

    keg = formula.installed_kegs.fetch(-1)
    tab = keg.tab
    # Force reinstallation upon `brew upgrade` to fix the bottle RPATH.
    tab.source["versions"]["version_scheme"] = -1
    tab.write
  rescue TapFormulaUnavailableError
    nil
  end

  Settings.write "gcc-rpaths.fixed", true
end

.no_changes_messageString

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:



8
9
10
# File 'extend/os/linux/cmd/update-report.rb', line 8

def no_changes_message
  "No changes to formulae."
end

.owner_uidInteger

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:



116
117
118
# File 'global.rb', line 116

def owner_uid
  @owner_uid ||= T.let(HOMEBREW_ORIGINAL_BREW_FILE.stat.uid, T.nilable(Integer))
end

.raise_deprecation_exceptions?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)


98
99
100
101
# File 'global.rb', line 98

def raise_deprecation_exceptions?
  @raise_deprecation_exceptions = T.let(@raise_deprecation_exceptions, T.nilable(T::Boolean))
  @raise_deprecation_exceptions == true
end

.running_as_root?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)


110
111
112
113
# File 'global.rb', line 110

def running_as_root?
  @process_euid ||= T.let(Process.euid, T.nilable(Integer))
  @process_euid.zero?
end

.running_as_root_but_not_owned_by_root?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)


121
122
123
# File 'global.rb', line 121

def running_as_root_but_not_owned_by_root?
  running_as_root? && !owner_uid.zero?
end

.running_command=(cmd) ⇒ void

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.

This method returns an undefined value.

Parameters:



131
132
133
# File 'global.rb', line 131

def running_command=(cmd)
  @running_command_with_args = T.let("#{cmd} #{ARGV.join(" ")}", T.nilable(String))
end

.running_command_with_argsString

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:



136
137
138
# File 'global.rb', line 136

def running_command_with_args
  "brew #{@running_command_with_args}".strip
end