Merge pull request #7285 from MikeMcQuaid/env_consolidation

Homebrew::EnvConfig: unify environment variables.
This commit is contained in:
Mike McQuaid 2020-04-07 10:35:36 +01:00 committed by GitHub
commit e12da9491d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
60 changed files with 833 additions and 648 deletions

View File

@ -28,10 +28,10 @@ class BottlePublisher
end end
def publish_changed_formula_bottles def publish_changed_formula_bottles
raise "Need to load formulae to publish them!" if ENV["HOMEBREW_DISABLE_LOAD_FORMULA"] raise "Need to load formulae to publish them!" if Homebrew::EnvConfig.disable_load_formula?
published = [] published = []
bintray_creds = { user: ENV["HOMEBREW_BINTRAY_USER"], key: ENV["HOMEBREW_BINTRAY_KEY"] } bintray_creds = { user: Homebrew::EnvConfig.bintray_user, key: Homebrew::EnvConfig.bintray_key }
if bintray_creds[:user] && bintray_creds[:key] if bintray_creds[:user] && bintray_creds[:key]
@changed_formulae_names.each do |name| @changed_formulae_names.each do |name|
f = Formula[name] f = Formula[name]
@ -82,7 +82,7 @@ class BottlePublisher
def verify_bintray_published(formulae_names) def verify_bintray_published(formulae_names)
return if formulae_names.empty? return if formulae_names.empty?
raise "Need to load formulae to verify their publication!" if ENV["HOMEBREW_DISABLE_LOAD_FORMULA"] raise "Need to load formulae to verify their publication!" if Homebrew::EnvConfig.disable_load_formula?
ohai "Verifying bottles published on Bintray" ohai "Verifying bottles published on Bintray"
formulae = formulae_names.map { |n| Formula[n] } formulae = formulae_names.map { |n| Formula[n] }

View File

@ -76,7 +76,7 @@ begin
internal_cmd = Commands.valid_internal_cmd?(cmd) internal_cmd = Commands.valid_internal_cmd?(cmd)
internal_cmd ||= begin internal_cmd ||= begin
internal_dev_cmd = Commands.valid_internal_dev_cmd?(cmd) internal_dev_cmd = Commands.valid_internal_dev_cmd?(cmd)
if internal_dev_cmd && !ARGV.homebrew_developer? if internal_dev_cmd && !Homebrew::EnvConfig.developer?
if (HOMEBREW_REPOSITORY/".git/config").exist? if (HOMEBREW_REPOSITORY/".git/config").exist?
system "git", "config", "--file=#{HOMEBREW_REPOSITORY}/.git/config", system "git", "config", "--file=#{HOMEBREW_REPOSITORY}/.git/config",
"--replace-all", "homebrew.devcmdrun", "true" "--replace-all", "homebrew.devcmdrun", "true"
@ -172,7 +172,7 @@ rescue MethodDeprecatedError => e
rescue Exception => e # rubocop:disable Lint/RescueException rescue Exception => e # rubocop:disable Lint/RescueException
onoe e onoe e
if internal_cmd && defined?(OS::ISSUES_URL) && if internal_cmd && defined?(OS::ISSUES_URL) &&
!ENV["HOMEBREW_NO_AUTO_UPDATE"] !Homebrew::EnvConfig.no_auto_update?
$stderr.puts "#{Tty.bold}Please report this issue:#{Tty.reset}" $stderr.puts "#{Tty.bold}Please report this issue:#{Tty.reset}"
$stderr.puts " #{Formatter.url(OS::ISSUES_URL)}" $stderr.puts " #{Formatter.url(OS::ISSUES_URL)}"
end end

View File

@ -136,9 +136,9 @@ then
HOMEBREW_FORCE_BREWED_GIT="1" HOMEBREW_FORCE_BREWED_GIT="1"
fi fi
HOMEBREW_CACHE="${HOMEBREW_CACHE:-${HOME}/Library/Caches/Homebrew}" HOMEBREW_DEFAULT_CACHE="${HOME}/Library/Caches/Homebrew"
HOMEBREW_LOGS="${HOMEBREW_LOGS:-${HOME}/Library/Logs/Homebrew}" HOMEBREW_DEFAULT_LOGS="${HOME}/Library/Logs/Homebrew"
HOMEBREW_SYSTEM_TEMP="/private/tmp" HOMEBREW_DEFAULT_TEMP="/private/tmp"
# Set a variable when the macOS system Ruby is new enough to avoid spawning # Set a variable when the macOS system Ruby is new enough to avoid spawning
# a Ruby process unnecessarily. # a Ruby process unnecessarily.
@ -180,9 +180,9 @@ else
fi fi
CACHE_HOME="${XDG_CACHE_HOME:-${HOME}/.cache}" CACHE_HOME="${XDG_CACHE_HOME:-${HOME}/.cache}"
HOMEBREW_CACHE="${HOMEBREW_CACHE:-${CACHE_HOME}/Homebrew}" HOMEBREW_DEFAULT_CACHE="${CACHE_HOME}/Homebrew"
HOMEBREW_LOGS="${HOMEBREW_LOGS:-${CACHE_HOME}/Homebrew/Logs}" HOMEBREW_DEFAULT_LOGS="${CACHE_HOME}/Homebrew/Logs"
HOMEBREW_SYSTEM_TEMP="/tmp" HOMEBREW_DEFAULT_TEMP="/tmp"
unset HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH unset HOMEBREW_MACOS_SYSTEM_RUBY_NEW_ENOUGH
fi fi
@ -194,7 +194,9 @@ else
HOMEBREW_BOTTLE_DEFAULT_DOMAIN="https://linuxbrew.bintray.com" HOMEBREW_BOTTLE_DEFAULT_DOMAIN="https://linuxbrew.bintray.com"
fi fi
HOMEBREW_TEMP="${HOMEBREW_TEMP:-${HOMEBREW_SYSTEM_TEMP}}" HOMEBREW_CACHE="${HOMEBREW_CACHE:-${HOMEBREW_DEFAULT_CACHE}}"
HOMEBREW_LOGS="${HOMEBREW_LOGS:-${HOMEBREW_DEFAULT_LOGS}}"
HOMEBREW_TEMP="${HOMEBREW_TEMP:-${HOMEBREW_DEFAULT_TEMP}}"
if [[ -n "$HOMEBREW_FORCE_BREWED_CURL" && if [[ -n "$HOMEBREW_FORCE_BREWED_CURL" &&
-x "$HOMEBREW_PREFIX/opt/curl/bin/curl" ]] && -x "$HOMEBREW_PREFIX/opt/curl/bin/curl" ]] &&
@ -230,13 +232,15 @@ export HOMEBREW_BREW_FILE
export HOMEBREW_PREFIX export HOMEBREW_PREFIX
export HOMEBREW_REPOSITORY export HOMEBREW_REPOSITORY
export HOMEBREW_LIBRARY export HOMEBREW_LIBRARY
export HOMEBREW_SYSTEM_TEMP
export HOMEBREW_TEMP
# Declared in brew.sh # Declared in brew.sh
export HOMEBREW_VERSION export HOMEBREW_VERSION
export HOMEBREW_DEFAULT_CACHE
export HOMEBREW_CACHE export HOMEBREW_CACHE
export HOMEBREW_DEFAULT_LOGS
export HOMEBREW_LOGS export HOMEBREW_LOGS
export HOMEBREW_DEFAULT_TEMP
export HOMEBREW_TEMP
export HOMEBREW_CELLAR export HOMEBREW_CELLAR
export HOMEBREW_SYSTEM export HOMEBREW_SYSTEM
export HOMEBREW_CURL export HOMEBREW_CURL
@ -374,23 +378,24 @@ then
export HOMEBREW_BOTTLE_DOMAIN="$HOMEBREW_BOTTLE_DEFAULT_DOMAIN" export HOMEBREW_BOTTLE_DOMAIN="$HOMEBREW_BOTTLE_DEFAULT_DOMAIN"
fi fi
HOMEBREW_DEFAULT_BREW_GIT_REMOTE="https://github.com/Homebrew/brew" export HOMEBREW_BREW_DEFAULT_GIT_REMOTE="https://github.com/Homebrew/brew"
if [[ -z "$HOMEBREW_BREW_GIT_REMOTE" ]] if [[ -z "$HOMEBREW_BREW_GIT_REMOTE" ]]
then then
HOMEBREW_BREW_GIT_REMOTE="$HOMEBREW_DEFAULT_BREW_GIT_REMOTE" HOMEBREW_BREW_GIT_REMOTE="$HOMEBREW_BREW_DEFAULT_GIT_REMOTE"
fi fi
export HOMEBREW_BREW_GIT_REMOTE export HOMEBREW_BREW_GIT_REMOTE
if [[ -n "$HOMEBREW_MACOS" ]] || [[ -n "$HOMEBREW_FORCE_HOMEBREW_ON_LINUX" ]] if [[ -n "$HOMEBREW_MACOS" ]] || [[ -n "$HOMEBREW_FORCE_HOMEBREW_ON_LINUX" ]]
then then
HOMEBREW_DEFAULT_CORE_GIT_REMOTE="https://github.com/Homebrew/homebrew-core" HOMEBREW_CORE_DEFAULT_GIT_REMOTE="https://github.com/Homebrew/homebrew-core"
else else
HOMEBREW_DEFAULT_CORE_GIT_REMOTE="https://github.com/Homebrew/linuxbrew-core" HOMEBREW_CORE_DEFAULT_GIT_REMOTE="https://github.com/Homebrew/linuxbrew-core"
fi fi
export HOMEBREW_CORE_DEFAULT_GIT_REMOTE
if [[ -z "$HOMEBREW_CORE_GIT_REMOTE" ]] if [[ -z "$HOMEBREW_CORE_GIT_REMOTE" ]]
then then
HOMEBREW_CORE_GIT_REMOTE="$HOMEBREW_DEFAULT_CORE_GIT_REMOTE" HOMEBREW_CORE_GIT_REMOTE="$HOMEBREW_CORE_DEFAULT_GIT_REMOTE"
fi fi
export HOMEBREW_CORE_GIT_REMOTE export HOMEBREW_CORE_GIT_REMOTE

View File

@ -140,7 +140,7 @@ module Cask
def summary def summary
s = +"" s = +""
s << "#{Emoji.install_badge} " if Emoji.enabled? s << "#{Homebrew::EnvConfig.install_badge} " unless Homebrew::EnvConfig.no_emoji?
s << "#{@cask} was successfully #{upgrade? ? "upgraded" : "installed"}!" s << "#{@cask} was successfully #{upgrade? ? "upgraded" : "installed"}!"
s.freeze s.freeze
end end

View File

@ -138,7 +138,7 @@ module Homebrew
end end
def self.install_formula_clean!(f) def self.install_formula_clean!(f)
return if ENV["HOMEBREW_NO_INSTALL_CLEANUP"] return if Homebrew::EnvConfig.no_install_cleanup?
cleanup = Cleanup.new cleanup = Cleanup.new
if cleanup.periodic_clean_due? if cleanup.periodic_clean_due?
@ -149,7 +149,7 @@ module Homebrew
end end
def periodic_clean_due? def periodic_clean_due?
return false if ENV["HOMEBREW_NO_INSTALL_CLEANUP"] return false if Homebrew::EnvConfig.no_install_cleanup?
return true unless PERIODIC_CLEAN_FILE.exist? return true unless PERIODIC_CLEAN_FILE.exist?
PERIODIC_CLEAN_FILE.mtime < CLEANUP_DEFAULT_DAYS.days.ago PERIODIC_CLEAN_FILE.mtime < CLEANUP_DEFAULT_DAYS.days.ago
@ -337,7 +337,7 @@ module Homebrew
.chomp .chomp
use_system_ruby = ( use_system_ruby = (
Gem::Version.new(system_ruby_version) >= Gem::Version.new(RUBY_VERSION) Gem::Version.new(system_ruby_version) >= Gem::Version.new(RUBY_VERSION)
) && ENV["HOMEBREW_FORCE_VENDOR_RUBY"].nil? ) && !Homebrew::EnvConfig.force_vendor_ruby?
vendor_path = HOMEBREW_LIBRARY/"Homebrew/vendor" vendor_path = HOMEBREW_LIBRARY/"Homebrew/vendor"
portable_ruby_version_file = vendor_path/"portable-ruby-version" portable_ruby_version_file = vendor_path/"portable-ruby-version"
portable_ruby_version = if portable_ruby_version_file.exist? portable_ruby_version = if portable_ruby_version_file.exist?

View File

@ -83,7 +83,11 @@ module Homebrew
alias switch_option switch alias switch_option switch
def env?(env) def env?(env)
env.present? && ENV["HOMEBREW_#{env.to_s.upcase}"].present? return false if env.blank?
Homebrew::EnvConfig.send("#{env}?")
rescue NoMethodError
false
end end
def usage_banner(text) def usage_banner(text)

View File

@ -20,10 +20,10 @@ module Homebrew
cat_args.parse cat_args.parse
cd HOMEBREW_REPOSITORY cd HOMEBREW_REPOSITORY
pager = if ENV["HOMEBREW_BAT"].nil? pager = if Homebrew::EnvConfig.bat?
"cat"
else
"#{HOMEBREW_PREFIX}/bin/bat" "#{HOMEBREW_PREFIX}/bin/bat"
else
"cat"
end end
safe_system pager, args.formulae.first.path, *args.passthrough safe_system pager, args.formulae.first.path, *args.passthrough
end end

View File

@ -68,7 +68,7 @@ module Homebrew
rescue Interrupt rescue Interrupt
raise raise
rescue => e rescue => e
raise if ARGV.homebrew_developer? raise if Homebrew::EnvConfig.developer?
fetched_bottle = false fetched_bottle = false
onoe e.message onoe e.message

View File

@ -98,7 +98,7 @@ module Homebrew
puts "#{n} symlinks created" puts "#{n} symlinks created"
end end
puts_keg_only_path_message(keg) if keg_only && !ARGV.homebrew_developer? puts_keg_only_path_message(keg) if keg_only && !Homebrew::EnvConfig.developer?
end end
end end
end end

View File

@ -110,7 +110,7 @@ module Homebrew
def check_for_dependents(kegs) def check_for_dependents(kegs)
return false unless result = Keg.find_some_installed_dependents(kegs) return false unless result = Keg.find_some_installed_dependents(kegs)
if ARGV.homebrew_developer? if Homebrew::EnvConfig.developer?
DeveloperDependentsMessage.new(*result).output DeveloperDependentsMessage.new(*result).output
else else
NondeveloperDependentsMessage.new(*result).output NondeveloperDependentsMessage.new(*result).output

View File

@ -97,7 +97,7 @@ module Homebrew
begin begin
reporter = Reporter.new(tap) reporter = Reporter.new(tap)
rescue Reporter::ReporterRevisionUnsetError => e rescue Reporter::ReporterRevisionUnsetError => e
onoe "#{e.message}\n#{e.backtrace.join "\n"}" if ARGV.homebrew_developer? onoe "#{e.message}\n#{e.backtrace.join "\n"}" if Homebrew::EnvConfig.developer?
next next
end end
if reporter.updated? if reporter.updated?
@ -225,7 +225,7 @@ class Reporter
# Don't care if the formula isn't available right now. # Don't care if the formula isn't available right now.
nil nil
rescue Exception => e # rubocop:disable Lint/RescueException rescue Exception => e # rubocop:disable Lint/RescueException
onoe "#{e.message}\n#{e.backtrace.join "\n"}" if ARGV.homebrew_developer? onoe "#{e.message}\n#{e.backtrace.join "\n"}" if Homebrew::EnvConfig.developer?
end end
@report[:M] << tap.formula_file_to_name(src) @report[:M] << tap.formula_file_to_name(src)
when /^R\d{0,3}/ when /^R\d{0,3}/
@ -316,7 +316,7 @@ class Reporter
system HOMEBREW_BREW_FILE, "link", new_full_name, "--overwrite" system HOMEBREW_BREW_FILE, "link", new_full_name, "--overwrite"
end end
rescue Exception => e # rubocop:disable Lint/RescueException rescue Exception => e # rubocop:disable Lint/RescueException
onoe "#{e.message}\n#{e.backtrace.join "\n"}" if ARGV.homebrew_developer? onoe "#{e.message}\n#{e.backtrace.join "\n"}" if Homebrew::EnvConfig.developer?
end end
next next
end end
@ -380,7 +380,7 @@ class Reporter
begin begin
f = Formulary.factory(new_full_name) f = Formulary.factory(new_full_name)
rescue Exception => e # rubocop:disable Lint/RescueException rescue Exception => e # rubocop:disable Lint/RescueException
onoe "#{e.message}\n#{e.backtrace.join "\n"}" if ARGV.homebrew_developer? onoe "#{e.message}\n#{e.backtrace.join "\n"}" if Homebrew::EnvConfig.developer?
next next
end end

View File

@ -30,7 +30,7 @@ git_init_if_necessary() {
trap '{ rm -rf .git; exit 1; }' EXIT trap '{ rm -rf .git; exit 1; }' EXIT
git init git init
git config --bool core.autocrlf false git config --bool core.autocrlf false
if [[ "$HOMEBREW_DEFAULT_BREW_GIT_REMOTE" != "$HOMEBREW_BREW_GIT_REMOTE" ]] if [[ "$HOMEBREW_BREW_DEFAULT_GIT_REMOTE" != "$HOMEBREW_BREW_GIT_REMOTE" ]]
then then
echo "HOMEBREW_BREW_GIT_REMOTE set: using $HOMEBREW_BREW_GIT_REMOTE for Homebrew/brew Git remote URL." echo "HOMEBREW_BREW_GIT_REMOTE set: using $HOMEBREW_BREW_GIT_REMOTE for Homebrew/brew Git remote URL."
fi fi
@ -52,7 +52,7 @@ git_init_if_necessary() {
trap '{ rm -rf .git; exit 1; }' EXIT trap '{ rm -rf .git; exit 1; }' EXIT
git init git init
git config --bool core.autocrlf false git config --bool core.autocrlf false
if [[ "$HOMEBREW_DEFAULT_CORE_GIT_REMOTE" != "$HOMEBREW_CORE_GIT_REMOTE" ]] if [[ "$HOMEBREW_CORE_DEFAULT_GIT_REMOTE" != "$HOMEBREW_CORE_GIT_REMOTE" ]]
then then
echo "HOMEBREW_CORE_GIT_REMOTE set: using $HOMEBREW_CORE_GIT_REMOTE for Homebrew/core Git remote URL." echo "HOMEBREW_CORE_GIT_REMOTE set: using $HOMEBREW_CORE_GIT_REMOTE for Homebrew/core Git remote URL."
fi fi
@ -414,7 +414,7 @@ EOS
git_init_if_necessary git_init_if_necessary
if [[ "$HOMEBREW_DEFAULT_BREW_GIT_REMOTE" != "$HOMEBREW_BREW_GIT_REMOTE" ]] if [[ "$HOMEBREW_BREW_DEFAULT_GIT_REMOTE" != "$HOMEBREW_BREW_GIT_REMOTE" ]]
then then
safe_cd "$HOMEBREW_REPOSITORY" safe_cd "$HOMEBREW_REPOSITORY"
echo "HOMEBREW_BREW_GIT_REMOTE set: using $HOMEBREW_BREW_GIT_REMOTE for Homebrew/brew Git remote." echo "HOMEBREW_BREW_GIT_REMOTE set: using $HOMEBREW_BREW_GIT_REMOTE for Homebrew/brew Git remote."
@ -424,7 +424,7 @@ EOS
git fetch --force origin --shallow-since="$latest_tag" git fetch --force origin --shallow-since="$latest_tag"
fi fi
if [[ "$HOMEBREW_DEFAULT_CORE_GIT_REMOTE" != "$HOMEBREW_CORE_GIT_REMOTE" ]] && if [[ "$HOMEBREW_CORE_DEFAULT_GIT_REMOTE" != "$HOMEBREW_CORE_GIT_REMOTE" ]] &&
[[ -d "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core" ]] [[ -d "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core" ]]
then then
safe_cd "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core" safe_cd "$HOMEBREW_LIBRARY/Taps/homebrew/homebrew-core"

View File

@ -114,7 +114,7 @@ module Homebrew
ENV["PATH"] = ENV["HOMEBREW_PATH"] ENV["PATH"] = ENV["HOMEBREW_PATH"]
# Use the user's browser, too. # Use the user's browser, too.
ENV["BROWSER"] = ENV["HOMEBREW_BROWSER"] ENV["BROWSER"] = Homebrew::EnvConfig.browser
formula = args.formulae.first formula = args.formulae.first

View File

@ -108,7 +108,7 @@ module Homebrew
end end
destination_tap = Tap.fetch(args.named.second) destination_tap = Tap.fetch(args.named.second)
unless ARGV.homebrew_developer? unless Homebrew::EnvConfig.developer?
odie "Cannot extract formula to homebrew/core!" if destination_tap.core_tap? odie "Cannot extract formula to homebrew/core!" if destination_tap.core_tap?
odie "Cannot extract formula to the same tap!" if destination_tap == source_tap odie "Cannot extract formula to the same tap!" if destination_tap == source_tap
end end

View File

@ -63,6 +63,7 @@ module Homebrew
variables[:developer_commands] = generate_cmd_manpages(Commands.internal_developer_commands_paths) variables[:developer_commands] = generate_cmd_manpages(Commands.internal_developer_commands_paths)
variables[:official_external_commands] = generate_cmd_manpages(Commands.official_external_commands_paths) variables[:official_external_commands] = generate_cmd_manpages(Commands.official_external_commands_paths)
variables[:global_options] = global_options_manpage variables[:global_options] = global_options_manpage
variables[:environment_variables] = env_vars_manpage
readme = HOMEBREW_REPOSITORY/"README.md" readme = HOMEBREW_REPOSITORY/"README.md"
variables[:lead] = variables[:lead] =
@ -207,9 +208,24 @@ module Homebrew
lines.join("\n") lines.join("\n")
end end
def env_vars_manpage
lines = Homebrew::EnvConfig::ENVS.flat_map do |env, hash|
entry = " * `#{env}`:\n #{hash[:description]}\n"
default = hash[:default_text]
default ||= "`#{hash[:default]}`." if hash[:default]
entry += "\n\n *Default:* #{default}\n" if default
entry
end
lines.join("\n")
end
def generate_option_doc(short, long, desc) def generate_option_doc(short, long, desc)
comma = (short && long) ? ", " : "" comma = (short && long) ? ", " : ""
"* #{format_short_opt(short)}" + comma + "#{format_long_opt(long)}:" + "\n " + desc + "\n" <<~EOS
* #{format_short_opt(short)}#{comma}#{format_long_opt(long)}:
#{desc}
EOS
end end
def format_short_opt(opt) def format_short_opt(opt)

View File

@ -22,8 +22,8 @@ module Homebrew
def mirror def mirror
mirror_args.parse mirror_args.parse
bintray_user = ENV["HOMEBREW_BINTRAY_USER"] bintray_user = Homebrew::EnvConfig.bintray_user
bintray_key = ENV["HOMEBREW_BINTRAY_KEY"] bintray_key = Homebrew::EnvConfig.bintray_key
raise "Missing HOMEBREW_BINTRAY_USER or HOMEBREW_BINTRAY_KEY variables!" if !bintray_user || !bintray_key raise "Missing HOMEBREW_BINTRAY_USER or HOMEBREW_BINTRAY_KEY variables!" if !bintray_user || !bintray_key
args.formulae.each do |f| args.formulae.each do |f|

View File

@ -72,8 +72,7 @@ module Homebrew
pull_args.parse pull_args.parse
# Passthrough Git environment variables for e.g. git am # Passthrough Git environment variables for e.g. git am
ENV["GIT_COMMITTER_NAME"] = ENV["HOMEBREW_GIT_NAME"] if ENV["HOMEBREW_GIT_NAME"] Utils.set_git_name_email!(author: false, committer: true)
ENV["GIT_COMMITTER_EMAIL"] = ENV["HOMEBREW_GIT_EMAIL"] if ENV["HOMEBREW_GIT_EMAIL"]
# Depending on user configuration, git may try to invoke gpg. # Depending on user configuration, git may try to invoke gpg.
if Utils.popen_read("git config --get --bool commit.gpgsign").chomp == "true" if Utils.popen_read("git config --get --bool commit.gpgsign").chomp == "true"
@ -168,7 +167,7 @@ module Homebrew
fetch_bottles = false fetch_bottles = false
changed_formulae_names.each do |name| changed_formulae_names.each do |name|
next if ENV["HOMEBREW_DISABLE_LOAD_FORMULA"] next if Homebrew::EnvConfig.disable_load_formula?
begin begin
f = Formula[name] f = Formula[name]
@ -213,7 +212,7 @@ module Homebrew
end end
is_bumpable = false if args.clean? is_bumpable = false if args.clean?
is_bumpable = false if ENV["HOMEBREW_DISABLE_LOAD_FORMULA"] is_bumpable = false if Homebrew::EnvConfig.disable_load_formula?
if is_bumpable if is_bumpable
formula = Formula[changed_formulae_names.first] formula = Formula[changed_formulae_names.first]

View File

@ -538,11 +538,11 @@ module Homebrew
end end
def check_brew_git_origin def check_brew_git_origin
examine_git_origin(HOMEBREW_REPOSITORY, HOMEBREW_BREW_GIT_REMOTE) examine_git_origin(HOMEBREW_REPOSITORY, Homebrew::EnvConfig.brew_git_remote)
end end
def check_coretap_git_origin def check_coretap_git_origin
examine_git_origin(CoreTap.instance.path, HOMEBREW_CORE_GIT_REMOTE) examine_git_origin(CoreTap.instance.path, Homebrew::EnvConfig.core_git_remote)
end end
def check_casktap_git_origin def check_casktap_git_origin

View File

@ -345,8 +345,8 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
@resolved_info_cache ||= {} @resolved_info_cache ||= {}
return @resolved_info_cache[url] if @resolved_info_cache.include?(url) return @resolved_info_cache[url] if @resolved_info_cache.include?(url)
if ENV["HOMEBREW_ARTIFACT_DOMAIN"] if (domain = Homebrew::EnvConfig.artifact_domain)
url = url.sub(%r{^((ht|f)tps?://)?}, ENV["HOMEBREW_ARTIFACT_DOMAIN"].chomp("/") + "/") url = url.sub(%r{^((ht|f)tps?://)?}, domain.chomp("/") + "/")
end end
out, _, status= curl_output("--location", "--silent", "--head", "--request", "GET", url.to_s) out, _, status= curl_output("--location", "--silent", "--head", "--request", "GET", url.to_s)
@ -402,7 +402,7 @@ class CurlDownloadStrategy < AbstractFileDownloadStrategy
def _fetch(url:, resolved_url:) def _fetch(url:, resolved_url:)
ohai "Downloading from #{resolved_url}" if url != resolved_url ohai "Downloading from #{resolved_url}" if url != resolved_url
if ENV["HOMEBREW_NO_INSECURE_REDIRECT"] && if Homebrew::EnvConfig.no_insecure_redirect? &&
url.start_with?("https://") && !resolved_url.start_with?("https://") url.start_with?("https://") && !resolved_url.start_with?("https://")
$stderr.puts "HTTPS to HTTP redirect detected & HOMEBREW_NO_INSECURE_REDIRECT is set." $stderr.puts "HTTPS to HTTP redirect detected & HOMEBREW_NO_INSECURE_REDIRECT is set."
raise CurlDownloadStrategyError, url raise CurlDownloadStrategyError, url
@ -784,7 +784,7 @@ class GitDownloadStrategy < VCSDownloadStrategy
git_dir = dot_git.read.chomp[/^gitdir: (.*)$/, 1] git_dir = dot_git.read.chomp[/^gitdir: (.*)$/, 1]
if git_dir.nil? if git_dir.nil?
onoe "Failed to parse '#{dot_git}'." if ARGV.homebrew_developer? onoe "Failed to parse '#{dot_git}'." if Homebrew::EnvConfig.developer?
next next
end end
@ -809,7 +809,7 @@ class GitHubGitDownloadStrategy < GitDownloadStrategy
end end
def github_last_commit def github_last_commit
return if ENV["HOMEBREW_NO_GITHUB_API"] return if Homebrew::EnvConfig.no_github_api?
output, _, status = curl_output( output, _, status = curl_output(
"--silent", "--head", "--location", "--silent", "--head", "--location",
@ -825,7 +825,7 @@ class GitHubGitDownloadStrategy < GitDownloadStrategy
end end
def multiple_short_commits_exist?(commit) def multiple_short_commits_exist?(commit)
return if ENV["HOMEBREW_NO_GITHUB_API"] return if Homebrew::EnvConfig.no_github_api?
output, _, status = curl_output( output, _, status = curl_output(
"--silent", "--head", "--location", "--silent", "--head", "--location",

View File

@ -1,13 +0,0 @@
# frozen_string_literal: true
module Emoji
class << self
def install_badge
ENV["HOMEBREW_INSTALL_BADGE"] || "🍺"
end
def enabled?
!ENV["HOMEBREW_NO_EMOJI"]
end
end
end

View File

@ -0,0 +1,308 @@
# frozen_string_literal: true
module Homebrew
module EnvConfig
module_function
ENVS = {
HOMEBREW_ARCH: {
description: "Linux only: Homebrew will pass the set value to type name to the compiler's `-march` option.",
default: "native",
},
HOMEBREW_ARTIFACT_DOMAIN: {
description: "Instructs Homebrew to prefix all download URLs, including those for bottles, with this " \
"variable. For example, `HOMEBREW_ARTIFACT_DOMAIN=http://localhost:8080` will cause a " \
"formula with the URL `https://example.com/foo.tar.gz` to instead download from " \
"`http://localhost:8080/example.com/foo.tar.gz`.",
},
HOMEBREW_AUTO_UPDATE_SECS: {
description: "Homebrew will only check for autoupdates once per this seconds interval.",
default: 300,
},
HOMEBREW_BAT: {
description: "Homebrew will use `bat` for the `brew cat` command.",
boolean: true,
},
HOMEBREW_BINTRAY_KEY: {
description: "Homebrew uses this API key when accessing the Bintray API (where bottles are stored).",
},
HOMEBREW_BINTRAY_USER: {
description: "Homebrew uses this username when accessing the Bintray API (where bottles are stored).",
},
HOMEBREW_BOTTLE_DOMAIN: {
description: "Instructs Homebrew to use the specified URL as its download mirror for bottles. " \
"For example, `HOMEBREW_BOTTLE_DOMAIN=http://localhost:8080` will cause all bottles to " \
"download from the prefix `http://localhost:8080/`.",
default_text: "macOS: `https://homebrew.bintray.com/`, Linux: `https://linuxbrew.bintray.com/`.",
default: HOMEBREW_BOTTLE_DEFAULT_DOMAIN,
},
HOMEBREW_BREW_GIT_REMOTE: {
description: "Instructs Homebrew to use the specified URL as its Homebrew/brew `git`(1) remote.",
default: HOMEBREW_BREW_DEFAULT_GIT_REMOTE,
},
HOMEBREW_BROWSER: {
description: "Homebrew uses this setting as the browser when opening project homepages.",
default_text: "`$BROWSER` or the OS's default browser.",
},
HOMEBREW_CACHE: {
description: "Instructs Homebrew to use the specified directory as the download cache.",
default_text: "macOS: `$HOME/Library/Caches/Homebrew`, " \
"Linux: `$XDG_CACHE_HOME/Homebrew` or `$HOME/.cache/Homebrew`.",
default: HOMEBREW_DEFAULT_CACHE,
},
HOMEBREW_COLOR: {
description: "Homebrew force colour output on non-TTY outputs.",
boolean: true,
},
HOMEBREW_CORE_GIT_REMOTE: {
description: "instructs Homebrew to use the specified URL as its Homebrew/homebrew-core `git`(1) remote.",
default_text: "macOS: `https://github.com/Homebrew/homebrew-core`, " \
"Linux: `https://github.com/Homebrew/linuxbrew-core`.",
default: HOMEBREW_CORE_DEFAULT_GIT_REMOTE,
},
HOMEBREW_CURLRC: {
description: "Homebrew will not pass `--disable` when invoking `curl`(1), which disables the " \
"use of `curlrc`.",
boolean: true,
},
HOMEBREW_CURL_RETRIES: {
description: "Homebrew will pass the given retry count to `--retry` when invoking `curl`(1).",
default: 3,
},
HOMEBREW_CURL_VERBOSE: {
description: "Homebrew will pass `--verbose` when invoking `curl`(1).",
boolean: true,
},
HOMEBREW_DEVELOPER: {
description: "Homebrew will tweak behaviour to be more relevant for Homebrew developers (active or " \
"budding), e.g. turning warnings into errors.",
boolean: true,
},
HOMEBREW_DISABLE_LOAD_FORMULA: {
description: "Homebrew will refuse to load formulae. This is useful when formulae are not trusted (such " \
"as in pull requests).",
boolean: true,
},
HOMEBREW_DISPLAY: {
description: "Homebrew will use this X11 display when opening a page in a browser, for example with " \
"`brew home`. Primarily useful on Linux.",
default_text: "`$DISPLAY`.",
},
HOMEBREW_DISPLAY_INSTALL_TIMES: {
description: "Homebrew will print install times for each formula at the end of the run.",
boolean: true,
},
HOMEBREW_EDITOR: {
description: "Homebrew will use this editor when editing a single formula, or several formulae in the " \
"same directory.\n\n *Note:* `brew edit` will open all of Homebrew as discontinuous files " \
"and directories. Visual Studio Code can handle this correctly in project mode, but many " \
"editors will do strange things in this case.",
default_text: "`$EDITOR` or `$VISUAL`.",
},
HOMEBREW_FAIL_LOG_LINES: {
description: "Homebrew will output this many lines of output on formula `system` failures.",
default: 15,
},
HOMEBREW_FORCE_BREWED_CURL: {
description: "Homebrew will always use a Homebrew-installed `curl`(1) rather than the system version. " \
"Automatically set if the system version of `curl` is too old.",
},
HOMEBREW_FORCE_BREWED_GIT: {
description: "Homebrew will always use a Homebrew-installed `git`(1) rather than the system version. " \
"Automatically set if the system version of `git` is too old.",
},
HOMEBREW_FORCE_HOMEBREW_ON_LINUX: {
description: "Homebrew running on Linux will use URLs for Homebrew on macOS. This is useful when merging" \
"pull requests on Linux for macOS.",
boolean: true,
},
HOMEBREW_FORCE_VENDOR_RUBY: {
description: "Homebrew will always use its vendored, relocatable Ruby version even if the system version " \
"of Ruby is new enough.",
boolean: true,
},
HOMEBREW_GITHUB_API_PASSWORD: {
description: "GitHub password for authentication with the GitHub API, used by Homebrew for features" \
"such as `brew search`. We strongly recommend using `HOMEBREW_GITHUB_API_TOKEN` instead.",
},
HOMEBREW_GITHUB_API_TOKEN: {
description: "A personal access token for the GitHub API, used by Homebrew for features such as " \
"`brew search`. You can create one at <https://github.com/settings/tokens>. If set, " \
"GitHub will allow you a greater number of API requests. For more information, see: " \
"<https://developer.github.com/v3/#rate-limiting>\n\n *Note:* Homebrew doesn't " \
"require permissions for any of the scopes.",
},
HOMEBREW_GITHUB_API_USERNAME: {
description: "GitHub username for authentication with the GitHub API, used by Homebrew for features " \
"such as `brew search`. We strongly recommend using `HOMEBREW_GITHUB_API_TOKEN` instead.",
},
HOMEBREW_GIT_EMAIL: {
description: "Homebrew will set the Git author and committer name to this value.",
},
HOMEBREW_GIT_NAME: {
description: "Homebrew will set the Git author and committer email to this value.",
},
HOMEBREW_INSTALL_BADGE: {
description: "Text printed before the installation summary of each successful build.",
default_text: 'The "Beer Mug" emoji.',
default: "🍺",
},
HOMEBREW_LOGS: {
description: "IHomebrew will use the specified directory to store log files.",
default_text: "macOS: `$HOME/Library/Logs/Homebrew`, "\
"Linux: `$XDG_CACHE_HOME/Homebrew/Logs` or `$HOME/.cache/Homebrew/Logs`.",
default: HOMEBREW_DEFAULT_LOGS,
},
HOMEBREW_MAKE_JOBS: {
description: "Instructs Homebrew to use the value of `HOMEBREW_MAKE_JOBS` as the number of " \
"parallel jobs to run when building with `make`(1).",
default_text: "The number of available CPU cores.",
default: lambda {
require "os"
require "hardware"
Hardware::CPU.cores
},
},
HOMEBREW_NO_ANALYTICS: {
description: "Homebrew will not send analytics. See: <https://docs.brew.sh/Analytics>.",
boolean: true,
},
HOMEBREW_NO_AUTO_UPDATE: {
description: "Homebrew will not auto-update before running `brew install`, `brew upgrade` or `brew tap`.",
boolean: true,
},
HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK: {
description: "Homebrew will fail on the failure of installation from a bottle rather than " \
"falling back to building from source.",
boolean: true,
},
HOMEBREW_NO_COLOR: {
description: "Homebrew will not print text with colour added.",
default_text: "`$NO_COLOR`.",
boolean: true,
},
HOMEBREW_NO_COMPAT: {
description: "Homebrew disables all use of legacy compatibility code.",
boolean: true,
},
HOMEBREW_NO_EMOJI: {
description: "Homebrew will not print the `HOMEBREW_INSTALL_BADGE` on a successful build." \
"\n\n *Note:* Homebrew will only try to print emoji on OS X Lion or newer.",
boolean: true,
},
HOMEBREW_NO_GITHUB_API: {
description: "Homebrew will not use the GitHub API, e.g. for searches or fetching relevant issues " \
"on a failed install.",
boolean: true,
},
HOMEBREW_NO_INSECURE_REDIRECT: {
description: "Homebrew will not permit redirects from secure HTTPS to insecure HTTP." \
"\n\n *Note:* While ensuring your downloads are fully secure, this is likely to cause " \
"from-source SourceForge, some GNU & GNOME based formulae to fail to download.",
boolean: true,
},
HOMEBREW_NO_INSTALL_CLEANUP: {
description: "`brew install`, `brew upgrade` and `brew reinstall` will never automatically cleanup " \
"installed/upgraded/reinstalled formulae or all formulae every 30 days.",
boolean: true,
},
HOMEBREW_PRY: {
description: "Homebrew will use Pry for the `brew irb` command.",
boolean: true,
},
HOMEBREW_SKIP_OR_LATER_BOTTLES: {
description: "Along with `HOMEBREW_DEVELOPER` Homebrew will not use bottles from older versions of macOS. " \
"This is useful in Homebrew development on new macOS versions.",
boolean: true,
},
HOMEBREW_SVN: {
description: "Forces Homebrew to use a particular `svn` binary. Otherwise, a Homebrew-built Subversion " \
"if installed, or the system-provided binary.",
},
HOMEBREW_TEMP: {
description: "Instructs Homebrew to use `HOMEBREW_TEMP` as the temporary directory for building " \
"packages. This may be needed if your system temp directory and Homebrew prefix are on " \
"different volumes, as macOS has trouble moving symlinks across volumes when the target" \
"does not yet exist. This issue typically occurs when using FileVault or custom SSD" \
"configurations.",
default_text: "macOS: `/private/tmp`, Linux: `/tmp`.",
default: HOMEBREW_DEFAULT_TEMP,
},
HOMEBREW_UPDATE_TO_TAG: {
description: "Instructs Homebrew to always use the latest stable tag (even if developer commands " \
"have been run).",
boolean: true,
},
HOMEBREW_VERBOSE: {
description: "Homebrew always assumes `--verbose` when running commands.",
boolean: true,
},
HOMEBREW_VERBOSE_USING_DOTS: {
boolean: true,
description: "Homebrew's verbose output will print a `.` no more than once a minute. This can be " \
"useful to avoid long-running Homebrew commands being killed due to no output.",
},
all_proxy: {
description: "Sets the SOCKS5 proxy to be used by `curl`(1), `git`(1) and `svn`(1) when downloading " \
"through Homebrew.",
},
ftp_proxy: {
description: "Sets the FTP proxy to be used by `curl`(1), `git`(1) and `svn`(1) when downloading " \
"through Homebrew.",
},
http_proxy: {
description: "Sets the HTTP proxy to be used by `curl`(1), `git`(1) and `svn`(1) when downloading " \
"through Homebrew.",
},
https_proxy: {
description: "Sets the HTTPS proxy to be used by `curl`(1), `git`(1) and `svn`(1) when downloading " \
"through Homebrew.",
},
no_proxy: {
description: "Sets the comma-separated list of hostnames and domain names that should be excluded " \
"from proxying by `curl`(1), `git`(1) and `svn`(1) when downloading through Homebrew.",
},
}.freeze
def env_method_name(env, hash)
method_name = env.to_s
.sub(/^HOMEBREW_/, "")
.downcase
method_name = "#{method_name}?" if hash[:boolean]
method_name
end
ENVS.each do |env, hash|
method_name = env_method_name(env, hash)
env = env.to_s
if hash[:boolean]
define_method(method_name) do
ENV[env].present?
end
elsif hash[:default].present?
# Needs a custom implementation.
next if env == "HOMEBREW_MAKE_JOBS"
define_method(method_name) do
ENV[env].presence || hash.fetch(:default).to_s
end
else
define_method(method_name) do
ENV[env].presence
end
end
end
# Needs a custom implementation.
def make_jobs
jobs = ENV["HOMEBREW_MAKE_JOBS"].to_i
return jobs.to_s if jobs.positive?
ENVS.fetch(:HOMEBREW_MAKE_JOBS)
.fetch(:default)
.call
.to_s
end
end
end

View File

@ -31,18 +31,6 @@ module HomebrewArgvExtension
flag?("--debug") || !ENV["HOMEBREW_DEBUG"].nil? flag?("--debug") || !ENV["HOMEBREW_DEBUG"].nil?
end end
def homebrew_developer?
!ENV["HOMEBREW_DEVELOPER"].nil?
end
def skip_or_later_bottles?
homebrew_developer? && !ENV["HOMEBREW_SKIP_OR_LATER_BOTTLES"].nil?
end
def no_sandbox?
include?("--no-sandbox") || !ENV["HOMEBREW_NO_SANDBOX"].nil?
end
def build_bottle? def build_bottle?
include?("--build-bottle") include?("--build-bottle")
end end

View File

@ -169,7 +169,7 @@ module Stdenv
# Sets architecture-specific flags for every environment variable # Sets architecture-specific flags for every environment variable
# given in the list `flags`. # given in the list `flags`.
# @private # @private
def set_cpu_flags(flags, map = Hardware::CPU.optimization_flags) # rubocop:disable Naming/AccessorMethodName def set_cpu_flags(flags, map = Hardware::CPU.optimization_flags)
cflags =~ /(-Xarch_#{Hardware::CPU.arch_32_bit} )-march=/ cflags =~ /(-Xarch_#{Hardware::CPU.arch_32_bit} )-march=/
xarch = Regexp.last_match(1).to_s xarch = Regexp.last_match(1).to_s
remove flags, /(-Xarch_#{Hardware::CPU.arch_32_bit} )?-march=\S*/ remove flags, /(-Xarch_#{Hardware::CPU.arch_32_bit} )?-march=\S*/
@ -188,12 +188,7 @@ module Stdenv
end end
def make_jobs def make_jobs
# '-j' requires a positive integral argument Homebrew::EnvConfig.make_jobs
if (jobs = self["HOMEBREW_MAKE_JOBS"].to_i).positive?
jobs
else
Hardware::CPU.cores
end
end end
# This method does nothing in stdenv since there's no arg refurbishment # This method does nothing in stdenv since there's no arg refurbishment

View File

@ -217,11 +217,7 @@ module Superenv
end end
def determine_make_jobs def determine_make_jobs
if (j = self["HOMEBREW_MAKE_JOBS"].to_i) < 1 Homebrew::EnvConfig.make_jobs
Hardware::CPU.cores
else
j
end
end end
def determine_optflags def determine_optflags

View File

@ -3,9 +3,8 @@
module Hardware module Hardware
class CPU class CPU
class << self class << self
native_arch = (ENV["HOMEBREW_ARCH"] || "native").freeze
OPTIMIZATION_FLAGS_LINUX = { OPTIMIZATION_FLAGS_LINUX = {
native: "-march=#{native_arch}", native: "-march=#{Homebrew::EnvConfig.arch}",
nehalem: "-march=nehalem", nehalem: "-march=nehalem",
core2: "-march=core2", core2: "-march=core2",
core: "-march=prescott", core: "-march=prescott",

View File

@ -93,7 +93,7 @@ class Keg
@bottle_dependencies ||= begin @bottle_dependencies ||= begin
formulae = relocation_formulae formulae = relocation_formulae
gcc = Formula["gcc"] gcc = Formula["gcc"]
if !ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"] && if !Homebrew::EnvConfig.force_homebrew_on_linux? &&
DevelopmentTools.non_apple_gcc_version("gcc") < gcc.version.to_i DevelopmentTools.non_apple_gcc_version("gcc") < gcc.version.to_i
formulae += gcc.recursive_dependencies.map(&:name) formulae += gcc.recursive_dependencies.map(&:name)
formulae << gcc.name formulae << gcc.name

View File

@ -4,6 +4,6 @@ class CoreTap < Tap
# @private # @private
def initialize def initialize
super "Homebrew", "core" super "Homebrew", "core"
@full_name = "Homebrew/linuxbrew-core" unless ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"] @full_name = "Homebrew/linuxbrew-core" unless Homebrew::EnvConfig.force_homebrew_on_linux?
end end
end end

View File

@ -4,13 +4,13 @@ module Utils
module Analytics module Analytics
class << self class << self
def formula_path def formula_path
return generic_formula_path if ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"] return generic_formula_path if Homebrew::EnvConfig.force_homebrew_on_linux?
"formula-linux" "formula-linux"
end end
def analytics_path def analytics_path
return generic_analytics_path if ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"] return generic_analytics_path if Homebrew::EnvConfig.force_homebrew_on_linux?
"analytics-linux" "analytics-linux"
end end

View File

@ -45,7 +45,7 @@ module Homebrew
end end
def check_for_unsupported_macos def check_for_unsupported_macos
return if ARGV.homebrew_developer? return if Homebrew::EnvConfig.developer?
who = +"We" who = +"We"
if OS::Mac.prerelease? if OS::Mac.prerelease?
@ -141,7 +141,7 @@ module Homebrew
def check_ruby_version def check_ruby_version
ruby_version = "2.6.3" ruby_version = "2.6.3"
return if RUBY_VERSION == ruby_version return if RUBY_VERSION == ruby_version
return if ARGV.homebrew_developer? && OS::Mac.prerelease? return if Homebrew::EnvConfig.developer? && OS::Mac.prerelease?
<<~EOS <<~EOS
Ruby version #{RUBY_VERSION} is unsupported on #{MacOS.version}. Homebrew Ruby version #{RUBY_VERSION} is unsupported on #{MacOS.version}. Homebrew

View File

@ -17,7 +17,8 @@ module Utils
def find_matching_tag(tag) def find_matching_tag(tag)
# Used primarily by developers testing beta macOS releases. # Used primarily by developers testing beta macOS releases.
if OS::Mac.prerelease? && ARGV.skip_or_later_bottles? if OS::Mac.prerelease? && Homebrew::EnvConfig.developer? &&
Homebrew::EnvConfig.skip_or_later_bottles?
generic_find_matching_tag(tag) generic_find_matching_tag(tag)
else else
generic_find_matching_tag(tag) || generic_find_matching_tag(tag) ||

View File

@ -1891,7 +1891,7 @@ class Formula
# system "make", "install"</pre> # system "make", "install"</pre>
def system(cmd, *args) def system(cmd, *args)
verbose = Homebrew.args.verbose? verbose = Homebrew.args.verbose?
verbose_using_dots = !ENV["HOMEBREW_VERBOSE_USING_DOTS"].nil? verbose_using_dots = Homebrew::EnvConfig.verbose_using_dots?
# remove "boring" arguments so that the important ones are more likely to # remove "boring" arguments so that the important ones are more likely to
# be shown considering that we trim long ohai lines to the terminal width # be shown considering that we trim long ohai lines to the terminal width
@ -1962,8 +1962,7 @@ class Formula
$stdout.flush $stdout.flush
unless $CHILD_STATUS.success? unless $CHILD_STATUS.success?
log_lines = ENV["HOMEBREW_FAIL_LOG_LINES"] log_lines = Homebrew::EnvConfig.fail_log_lines
log_lines ||= "15"
log.flush log.flush
if !verbose || verbose_using_dots if !verbose || verbose_using_dots

View File

@ -11,7 +11,6 @@ require "formula_cellar_checks"
require "install_renamed" require "install_renamed"
require "debrew" require "debrew"
require "sandbox" require "sandbox"
require "emoji"
require "development_tools" require "development_tools"
require "cache_store" require "cache_store"
require "linkage_checker" require "linkage_checker"
@ -306,9 +305,9 @@ class FormulaInstaller
end end
formula.rack.rmdir_if_possible formula.rack.rmdir_if_possible
end end
raise if ARGV.homebrew_developer? || raise if Homebrew::EnvConfig.developer? ||
e.is_a?(Interrupt) || Homebrew::EnvConfig.no_bottle_source_fallback? ||
ENV["HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK"] e.is_a?(Interrupt)
@pour_failed = true @pour_failed = true
onoe e.message onoe e.message
@ -372,7 +371,7 @@ class FormulaInstaller
'conflicts_with \"#{c.name}\"' should be removed from #{formula.path.basename}. 'conflicts_with \"#{c.name}\"' should be removed from #{formula.path.basename}.
EOS EOS
raise if ARGV.homebrew_developer? raise if Homebrew::EnvConfig.developer?
$stderr.puts "Please report this issue to the #{formula.tap} tap (not Homebrew/brew or Homebrew/core)!" $stderr.puts "Please report this issue to the #{formula.tap} tap (not Homebrew/brew or Homebrew/core)!"
false false
@ -621,7 +620,7 @@ class FormulaInstaller
def caveats def caveats
return if only_deps? return if only_deps?
audit_installed if ARGV.homebrew_developer? audit_installed if Homebrew::EnvConfig.developer?
caveats = Caveats.new(formula) caveats = Caveats.new(formula)
@ -684,7 +683,7 @@ class FormulaInstaller
def summary def summary
s = +"" s = +""
s << "#{Emoji.install_badge} " if Emoji.enabled? s << "#{Homebrew::EnvConfig.install_badge} " unless Homebrew::EnvConfig.no_emoji?
s << "#{formula.prefix.resolved_path}: #{formula.prefix.abv}" s << "#{formula.prefix.resolved_path}: #{formula.prefix.abv}"
s << ", built in #{pretty_duration build_time}" if build_time s << ", built in #{pretty_duration build_time}" if build_time
s.freeze s.freeze
@ -943,7 +942,7 @@ class FormulaInstaller
rescue Exception => e # rubocop:disable Lint/RescueException rescue Exception => e # rubocop:disable Lint/RescueException
opoo "The post-install step did not complete successfully" opoo "The post-install step did not complete successfully"
puts "You can try again using `brew postinstall #{formula.full_name}`" puts "You can try again using `brew postinstall #{formula.full_name}`"
ohai e, e.backtrace if debug? || ARGV.homebrew_developer? ohai e, e.backtrace if debug? || Homebrew::EnvConfig.developer?
Homebrew.failed = true Homebrew.failed = true
@show_summary_heading = true @show_summary_heading = true
end end

View File

@ -26,7 +26,7 @@ module Formulary
end end
def self.load_formula(name, path, contents, namespace) def self.load_formula(name, path, contents, namespace)
raise "Formula loading disabled by HOMEBREW_DISABLE_LOAD_FORMULA!" if ENV["HOMEBREW_DISABLE_LOAD_FORMULA"] raise "Formula loading disabled by HOMEBREW_DISABLE_LOAD_FORMULA!" if Homebrew::EnvConfig.disable_load_formula?
mod = Module.new mod = Module.new
const_set(namespace, mod) const_set(namespace, mod)

View File

@ -25,6 +25,14 @@ ActiveSupport::Inflector.inflections(:en) do |inflect|
inflect.irregular "it", "they" inflect.irregular "it", "they"
end end
HOMEBREW_BOTTLE_DEFAULT_DOMAIN = ENV["HOMEBREW_BOTTLE_DEFAULT_DOMAIN"]
HOMEBREW_BREW_DEFAULT_GIT_REMOTE = ENV["HOMEBREW_BREW_DEFAULT_GIT_REMOTE"]
HOMEBREW_CORE_DEFAULT_GIT_REMOTE = ENV["HOMEBREW_CORE_DEFAULT_GIT_REMOTE"]
HOMEBREW_DEFAULT_CACHE = ENV["HOMEBREW_DEFAULT_CACHE"]
HOMEBREW_DEFAULT_LOGS = ENV["HOMEBREW_DEFAULT_LOGS"]
HOMEBREW_DEFAULT_TEMP = ENV["HOMEBREW_DEFAULT_TEMP"]
require "env_config"
require "config" require "config"
require "os" require "os"
require "extend/ARGV" require "extend/ARGV"
@ -51,12 +59,6 @@ HOMEBREW_USER_AGENT_FAKE_SAFARI =
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 " \ "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_3) AppleWebKit/602.4.8 " \
"(KHTML, like Gecko) Version/10.0.3 Safari/602.4.8" "(KHTML, like Gecko) Version/10.0.3 Safari/602.4.8"
HOMEBREW_BOTTLE_DEFAULT_DOMAIN = ENV["HOMEBREW_BOTTLE_DEFAULT_DOMAIN"]
HOMEBREW_BOTTLE_DOMAIN = ENV["HOMEBREW_BOTTLE_DOMAIN"]
HOMEBREW_BREW_GIT_REMOTE = ENV["HOMEBREW_BREW_GIT_REMOTE"]
HOMEBREW_CORE_GIT_REMOTE = ENV["HOMEBREW_CORE_GIT_REMOTE"]
HOMEBREW_DEFAULT_PREFIX = "/usr/local" HOMEBREW_DEFAULT_PREFIX = "/usr/local"
LINUXBREW_DEFAULT_PREFIX = "/home/linuxbrew/.linuxbrew" LINUXBREW_DEFAULT_PREFIX = "/home/linuxbrew/.linuxbrew"
@ -134,4 +136,4 @@ require "official_taps"
require "tap" require "tap"
require "tap_constants" require "tap_constants"
require "compat" if !ARGV.include?("--no-compat") && !ENV["HOMEBREW_NO_COMPAT"] require "compat" unless Homebrew::EnvConfig.no_compat?

View File

@ -1,5 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
require "utils/popen"
module Hardware module Hardware
class CPU class CPU
INTEL_32BIT_ARCHS = [:i386].freeze INTEL_32BIT_ARCHS = [:i386].freeze

View File

@ -83,7 +83,7 @@ module Homebrew
output ||= comment_help(path) output ||= comment_help(path)
output ||= if output.blank? output ||= if output.blank?
opoo "No help text in: #{path}" if ARGV.homebrew_developer? opoo "No help text in: #{path}" if Homebrew::EnvConfig.developer?
HOMEBREW_HELP HOMEBREW_HELP
end end

View File

@ -10,7 +10,7 @@ module Language
# e.g. `resource "github.com/foo/bar"` # e.g. `resource "github.com/foo/bar"`
def self.stage_deps(resources, target) def self.stage_deps(resources, target)
if resources.empty? if resources.empty?
if ARGV.homebrew_developer? if Homebrew::EnvConfig.developer?
odie "tried to stage empty Language::Go resources array" odie "tried to stage empty Language::Go resources array"
else else
opoo "tried to stage empty Language::Go resources array" opoo "tried to stage empty Language::Go resources array"

View File

@ -109,205 +109,7 @@ Note that environment variables must have a value set to be detected. For exampl
`export HOMEBREW_NO_INSECURE_REDIRECT=1` rather than just `export HOMEBREW_NO_INSECURE_REDIRECT=1` rather than just
`export HOMEBREW_NO_INSECURE_REDIRECT`. `export HOMEBREW_NO_INSECURE_REDIRECT`.
* `HOMEBREW_ARCH`: <%= environment_variables %>
Linux only: If set, Homebrew will pass the set value to type name to the compiler's
`-march` option instead of using the default (`-march=native`).
* `HOMEBREW_ARTIFACT_DOMAIN`:
If set, instructs Homebrew to prefix all download URLs, including those for bottles,
with this variable. For example, `HOMEBREW_ARTIFACT_DOMAIN=http://localhost:8080`
will cause a formula with the URL `https://example.com/foo.tar.gz` to instead
download from `http://localhost:8080/example.com/foo.tar.gz`.
* `HOMEBREW_AUTO_UPDATE_SECS`:
If set, Homebrew will only check for autoupdates once per this seconds interval.
*Default:* `300`.
* `HOMEBREW_AWS_ACCESS_KEY_ID`, `HOMEBREW_AWS_SECRET_ACCESS_KEY`:
When using the `S3` download strategy, Homebrew will look in
these variables for access credentials (see
<https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-environment>
to retrieve these access credentials from AWS). If they are not set,
the `S3` download strategy will download with a public (unsigned) URL.
* `HOMEBREW_BAT`:
If set, Homebrew will use `bat` for the `brew cat` command.
* `HOMEBREW_BOTTLE_DOMAIN`:
By default, Homebrew uses `https://homebrew.bintray.com/` as its download
mirror for bottles. If set, instructs Homebrew to instead use the specified
URL. For example, `HOMEBREW_BOTTLE_DOMAIN=http://localhost:8080` will
cause all bottles to download from the prefix `http://localhost:8080/`.
* `HOMEBREW_BREW_GIT_REMOTE`:
By default, Homebrew uses `https://github.com/Homebrew/brew` as its
Homebrew/brew `git`(1) remote. If set, instructs Homebrew to instead use
the specified URL.
* `HOMEBREW_BROWSER`:
If set, Homebrew uses this setting as the browser when opening project
homepages, instead of the OS default browser.
* `HOMEBREW_CACHE`:
If set, instructs Homebrew to use the specified directory as the download cache.
*Default:* `~/Library/Caches/Homebrew`.
* `HOMEBREW_CORE_GIT_REMOTE`:
By default, Homebrew uses `https://github.com/Homebrew/homebrew-core` (or
`https://github.com/Homebrew/linuxbrew-core`) as its Homebrew/homebrew-core
`git`(1) remote. If set, instructs Homebrew to instead use the specified URL.
* `HOMEBREW_CURLRC`:
If set, Homebrew will not pass `--disable` when invoking `curl`(1), which disables
the use of `curlrc`.
* `HOMEBREW_CURL_VERBOSE`:
If set, Homebrew will pass `--verbose` when invoking `curl`(1).
* `HOMEBREW_CURL_RETRIES`:
If set, Homebrew will pass the given retry count to `--retry` when invoking `curl`(1).
By default, `curl`(1) is invoked with `--retry 3`.
* `HOMEBREW_DEBUG`:
If set, any commands that can emit debugging information will do so.
* `HOMEBREW_DEVELOPER`:
If set, Homebrew will tweak behaviour to be more relevant for Homebrew
developers (active or budding), e.g. turning warnings into errors.
* `HOMEBREW_DISPLAY`:
If set, Homebrew will use this X11 display when opening a page in a browser,
for example with `brew home`. Primarily useful on Linux.
*Default:* the value of the user's `DISPLAY` environment variable.
* `HOMEBREW_DISPLAY_INSTALL_TIMES`:
If set, Homebrew will print install times for each formula at the end of the run.
* `HOMEBREW_EDITOR`:
If set, Homebrew will use this editor when editing a single formula, or
several formulae in the same directory.
*Note:* `brew edit` will open all of Homebrew as discontinuous files and
directories. TextMate can handle this correctly in project mode, but many
editors will do strange things in this case.
* `HOMEBREW_FORCE_BREWED_CURL`:
If set, Homebrew will always use a Homebrew-installed `curl` rather than the
system version. Automatically set if the system version of `curl` is too old.
* `HOMEBREW_FORCE_VENDOR_RUBY`:
If set, Homebrew will always use its vendored, relocatable Ruby version
even if the system version of Ruby is new enough.
* `HOMEBREW_FORCE_BREWED_GIT`:
If set, Homebrew will always use a Homebrew-installed `git`(1) rather than the
system version. Automatically set if the system version of `git` is too old.
* `HOMEBREW_GITHUB_API_TOKEN`:
A personal access token for the GitHub API, used by Homebrew for features
such as `brew search`. You can create one at <https://github.com/settings/tokens>.
If set, GitHub will allow you a greater number of API requests. For more
information, see: <https://developer.github.com/v3/#rate-limiting>
*Note:* Homebrew doesn't require permissions for any of the scopes.
* `HOMEBREW_INSTALL_BADGE`:
Text printed before the installation summary of each successful build.
*Default:* the beer emoji.
* `HOMEBREW_LOGS`:
If set, Homebrew will use the specified directory to store log files.
* `HOMEBREW_MAKE_JOBS`:
If set, instructs Homebrew to use the value of `HOMEBREW_MAKE_JOBS` as
the number of parallel jobs to run when building with `make`(1).
*Default:* the number of available CPU cores.
* `HOMEBREW_NO_ANALYTICS`:
If set, Homebrew will not send analytics. See: <https://docs.brew.sh/Analytics>
* `HOMEBREW_NO_AUTO_UPDATE`:
If set, Homebrew will not auto-update before running `brew install`,
`brew upgrade` or `brew tap`.
* `HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK`:
If set, Homebrew will fail on the failure of installation from a bottle
rather than falling back to building from source.
* `HOMEBREW_NO_COLOR`:
If set, Homebrew will not print text with colour added.
* `HOMEBREW_NO_EMOJI`:
If set, Homebrew will not print the `HOMEBREW_INSTALL_BADGE` on a
successful build.
*Note:* Homebrew will only try to print emoji on OS X Lion or newer.
* `HOMEBREW_NO_INSECURE_REDIRECT`:
If set, Homebrew will not permit redirects from secure HTTPS
to insecure HTTP.
While ensuring your downloads are fully secure, this is likely
to cause from-source SourceForge, some GNU & GNOME based
formulae to fail to download.
* `HOMEBREW_NO_GITHUB_API`:
If set, Homebrew will not use the GitHub API, e.g. for searches or
fetching relevant issues on a failed install.
* `HOMEBREW_NO_INSTALL_CLEANUP`:
If set, `brew install`, `brew upgrade` and `brew reinstall` will never
automatically cleanup the installed/upgraded/reinstalled formulae or all
formulae every 30 days.
* `HOMEBREW_PRY`:
If set, Homebrew will use Pry for the `brew irb` command.
* `HOMEBREW_SVN`:
When exporting from Subversion, Homebrew will use `HOMEBREW_SVN` if set,
a Homebrew-built Subversion if installed, or the system-provided binary.
Set this to force Homebrew to use a particular `svn` binary.
* `HOMEBREW_TEMP`:
If set, instructs Homebrew to use `HOMEBREW_TEMP` as the temporary directory
for building packages. This may be needed if your system temp directory and
Homebrew prefix are on different volumes, as macOS has trouble moving
symlinks across volumes when the target does not yet exist.
This issue typically occurs when using FileVault or custom SSD configurations.
* `HOMEBREW_UPDATE_TO_TAG`:
If set, instructs Homebrew to always use the latest stable tag (even if
developer commands have been run).
* `HOMEBREW_VERBOSE`:
If set, Homebrew always assumes `--verbose` when running commands.
* `http_proxy`:
Sets the HTTP proxy to be used by `curl`, `git` and `svn` when downloading
through Homebrew.
* `https_proxy`:
Sets the HTTPS proxy to be used by `curl`, `git` and `svn` when downloading
through Homebrew.
* `all_proxy`:
Sets the SOCKS5 proxy to be used by `curl`, `git` and `svn` when downloading
through Homebrew.
* `ftp_proxy`:
Sets the FTP proxy to be used by `curl`, `git` and `svn` when downloading
through Homebrew.
* `no_proxy`:
Sets the comma-separated list of hostnames and domain names that should be excluded
from proxying by `curl`, `git` and `svn` when downloading through Homebrew.
## USING HOMEBREW BEHIND A PROXY ## USING HOMEBREW BEHIND A PROXY

View File

@ -1,7 +1,7 @@
# frozen_string_literal: true # frozen_string_literal: true
module Homebrew module Homebrew
DEFAULT_PREFIX ||= if ENV["HOMEBREW_FORCE_HOMEBREW_ON_LINUX"] DEFAULT_PREFIX ||= if Homebrew::EnvConfig.force_homebrew_on_linux?
HOMEBREW_DEFAULT_PREFIX HOMEBREW_DEFAULT_PREFIX
else else
LINUXBREW_DEFAULT_PREFIX LINUXBREW_DEFAULT_PREFIX

View File

@ -50,7 +50,7 @@ module MachOShim
rescue rescue
# ... but complain about other (parse) errors for further investigation. # ... but complain about other (parse) errors for further investigation.
onoe "Failed to read Mach-O binary: #{self}" onoe "Failed to read Mach-O binary: #{self}"
raise if ARGV.homebrew_developer? raise if Homebrew::EnvConfig.developer?
[] []
end end

View File

@ -10,16 +10,16 @@ class Sandbox
OS.mac? && File.executable?(SANDBOX_EXEC) OS.mac? && File.executable?(SANDBOX_EXEC)
end end
def self.formula?(_formula) def self.formula?(_)
return false unless available? return false unless available?
!ARGV.no_sandbox? !Homebrew.args.no_sandbox?
end end
def self.test? def self.test?
return false unless available? return false unless available?
!ARGV.no_sandbox? !Homebrew.args.no_sandbox?
end end
def initialize def initialize
@ -127,7 +127,7 @@ class Sandbox
end end
end end
if @failed && ENV["HOMEBREW_VERBOSE"].present? if @failed && Homebrew::EnvConfig.verbose?
ohai "Sandbox log" ohai "Sandbox log"
puts logs puts logs
$stdout.flush # without it, brew test-bot would fail to catch the log $stdout.flush # without it, brew test-bot would fail to catch the log

View File

@ -30,7 +30,7 @@ module Homebrew
results = { formulae: [], casks: [] } results = { formulae: [], casks: [] }
return results if ENV["HOMEBREW_NO_GITHUB_API"] return results if Homebrew::EnvConfig.no_github_api?
unless silent unless silent
# Use stderr to avoid breaking parsed output # Use stderr to avoid breaking parsed output

View File

@ -346,7 +346,7 @@ class BottleSpecification
def root_url(var = nil, specs = {}) def root_url(var = nil, specs = {})
if var.nil? if var.nil?
@root_url ||= "#{HOMEBREW_BOTTLE_DOMAIN}/#{Utils::Bottles::Bintray.repository(tap)}" @root_url ||= "#{Homebrew::EnvConfig.bottle_domain}/#{Utils::Bottles::Bintray.repository(tap)}"
else else
@root_url = var @root_url = var
@root_url_specs.merge!(specs) @root_url_specs.merge!(specs)

View File

@ -119,67 +119,37 @@ class SystemConfig
else else
f.puts "Core tap: N/A" f.puts "Core tap: N/A"
end end
defaults_hash = {
HOMEBREW_PREFIX: Homebrew::DEFAULT_PREFIX,
HOMEBREW_REPOSITORY: Homebrew::DEFAULT_REPOSITORY,
HOMEBREW_CELLAR: Homebrew::DEFAULT_CELLAR,
HOMEBREW_CACHE: "#{ENV["HOME"]}/Library/Caches/Homebrew",
HOMEBREW_LOGS: "#{ENV["HOME"]}/Library/Logs/Homebrew",
HOMEBREW_TEMP: ENV["HOMEBREW_SYSTEM_TEMP"],
HOMEBREW_RUBY_WARNINGS: "-W0",
}.freeze
boring_keys = %w[
HOMEBREW_BROWSER
HOMEBREW_EDITOR
HOMEBREW_ANALYTICS_ID
HOMEBREW_ANALYTICS_USER_UUID
HOMEBREW_AUTO_UPDATE_CHECKED
HOMEBREW_BOTTLE_DEFAULT_DOMAIN
HOMEBREW_BOTTLE_DOMAIN
HOMEBREW_BREW_FILE
HOMEBREW_BREW_GIT_REMOTE
HOMEBREW_COMMAND_DEPTH
HOMEBREW_CORE_GIT_REMOTE
HOMEBREW_CURL
HOMEBREW_DISPLAY
HOMEBREW_GIT
HOMEBREW_GIT_CONFIG_FILE
HOMEBREW_LIBRARY
HOMEBREW_MACOS_VERSION
HOMEBREW_MACOS_VERSION_NUMERIC
HOMEBREW_MINIMUM_GIT_VERSION
HOMEBREW_RUBY_PATH
HOMEBREW_SYSTEM
HOMEBREW_SYSTEM_TEMP
HOMEBREW_OS_VERSION
HOMEBREW_PATH
HOMEBREW_PROCESSOR
HOMEBREW_PRODUCT
HOMEBREW_USER_AGENT
HOMEBREW_USER_AGENT_CURL
HOMEBREW_VERSION
].freeze
f.puts "HOMEBREW_PREFIX: #{HOMEBREW_PREFIX}" f.puts "HOMEBREW_PREFIX: #{HOMEBREW_PREFIX}"
[:HOMEBREW_CELLAR, :HOMEBREW_CACHE, :HOMEBREW_LOGS, :HOMEBREW_REPOSITORY, {
:HOMEBREW_TEMP].each do |key| HOMEBREW_REPOSITORY: Homebrew::DEFAULT_REPOSITORY,
HOMEBREW_CELLAR: Homebrew::DEFAULT_CELLAR,
}.freeze.each do |key, default|
value = Object.const_get(key) value = Object.const_get(key)
f.puts "#{key}: #{value}" if defaults_hash[key] != value.to_s f.puts "#{key}: #{value}" if value.to_s != default.to_s
end end
if defaults_hash[:HOMEBREW_RUBY_WARNINGS] != ENV["HOMEBREW_RUBY_WARNINGS"].to_s
f.puts "HOMEBREW_RUBY_WARNINGS: #{ENV["HOMEBREW_RUBY_WARNINGS"]}"
end
unless ENV["HOMEBREW_ENV"]
ENV.sort.each do |key, value|
next unless key.start_with?("HOMEBREW_")
next if key.start_with?("HOMEBREW_BUNDLE_")
next if boring_keys.include?(key)
next if defaults_hash[key.to_sym]
value = "set" if ENV.sensitive?(key) Homebrew::EnvConfig::ENVS.each do |env, hash|
f.puts "#{key}: #{value}" method_name = Homebrew::EnvConfig.env_method_name(env, hash)
if hash[:boolean]
f.puts "#{env}: set" if Homebrew::EnvConfig.send(method_name)
next
end
value = Homebrew::EnvConfig.send(method_name)
next unless value
if (default = hash[:default].presence)
next if value.to_s == default.to_s
end
if ENV.sensitive?(env)
f.puts "#{env}: set"
else
f.puts "#{env}: #{value}"
end end
end end
f.puts hardware if hardware f.puts hardware if hardware
f.puts "Homebrew Ruby: #{describe_homebrew_ruby}" f.puts "Homebrew Ruby: #{describe_homebrew_ruby}"
f.print "Clang: " f.print "Clang: "

View File

@ -272,7 +272,7 @@ class Tap
begin begin
safe_system "git", *args safe_system "git", *args
unless Readall.valid_tap?(self, aliases: true) unless Readall.valid_tap?(self, aliases: true)
raise "Cannot tap #{name}: invalid syntax in tap!" unless ARGV.homebrew_developer? raise "Cannot tap #{name}: invalid syntax in tap!" unless Homebrew::EnvConfig.developer?
end end
rescue Interrupt, RuntimeError rescue Interrupt, RuntimeError
ignore_interrupts do ignore_interrupts do
@ -641,12 +641,9 @@ class CoreTap < Tap
end end
def install(full_clone: true, quiet: false, clone_target: nil, force_auto_update: nil) def install(full_clone: true, quiet: false, clone_target: nil, force_auto_update: nil)
if HOMEBREW_CORE_GIT_REMOTE != default_remote remote = Homebrew::EnvConfig.core_git_remote
puts "HOMEBREW_CORE_GIT_REMOTE set: using #{HOMEBREW_CORE_GIT_REMOTE} " \ puts "HOMEBREW_CORE_GIT_REMOTE set: using #{remote} for Homebrew/core Git remote URL." if remote != default_remote
"for Homebrew/core Git remote URL." super(full_clone: full_clone, quiet: quiet, clone_target: remote, force_auto_update: force_auto_update)
clone_target ||= HOMEBREW_CORE_GIT_REMOTE
end
super(full_clone: full_clone, quiet: quiet, clone_target: clone_target, force_auto_update: force_auto_update)
end end
# @private # @private

View File

@ -30,6 +30,7 @@ RSpec/FilePath:
- 'checksum_verification_spec.rb' - 'checksum_verification_spec.rb'
- 'cxxstdlib_spec.rb' - 'cxxstdlib_spec.rb'
- 'diagnostic_checks_spec.rb' - 'diagnostic_checks_spec.rb'
- 'env_config_spec.rb'
- 'missing_formula_spec.rb' - 'missing_formula_spec.rb'
- 'os/linux/diagnostic_spec.rb' - 'os/linux/diagnostic_spec.rb'
- 'os/mac/diagnostic_spec.rb' - 'os/mac/diagnostic_spec.rb'

View File

@ -13,8 +13,7 @@ describe Homebrew::CLI::Parser do
} }
before do before do
allow(ENV).to receive(:[]) allow(Homebrew::EnvConfig).to receive(:pry?).and_return(true)
allow(ENV).to receive(:[]).with("HOMEBREW_PRY").and_return("1")
end end
it "parses short option" do it "parses short option" do
@ -181,18 +180,16 @@ describe Homebrew::CLI::Parser do
end end
it "prioritizes cli arguments over env vars when they conflict" do it "prioritizes cli arguments over env vars when they conflict" do
allow(ENV).to receive(:[]) allow(Homebrew::EnvConfig).to receive(:switch_a?).and_return(true)
allow(ENV).to receive(:[]).with("HOMEBREW_SWITCH_A").and_return("1") allow(Homebrew::EnvConfig).to receive(:switch_b?).and_return(false)
allow(ENV).to receive(:[]).with("HOMEBREW_SWITCH_B").and_return(nil)
parser.parse(["--switch-b"]) parser.parse(["--switch-b"])
expect(Homebrew.args.switch_a).to be_falsy expect(Homebrew.args.switch_a).to be_falsy
expect(Homebrew.args).to be_switch_b expect(Homebrew.args).to be_switch_b
end end
it "raises an exception on constraint violation when both are env vars" do it "raises an exception on constraint violation when both are env vars" do
allow(ENV).to receive(:[]) allow(Homebrew::EnvConfig).to receive(:switch_a?).and_return(true)
allow(ENV).to receive(:[]).with("HOMEBREW_SWITCH_A").and_return("1") allow(Homebrew::EnvConfig).to receive(:switch_b?).and_return(true)
allow(ENV).to receive(:[]).with("HOMEBREW_SWITCH_B").and_return("1")
expect { parser.parse([]) }.to raise_error(Homebrew::CLI::OptionConflictError) expect { parser.parse([]) }.to raise_error(Homebrew::CLI::OptionConflictError)
end end
end end

View File

@ -1,22 +0,0 @@
# frozen_string_literal: true
require "emoji"
describe Emoji do
describe "#install_badge" do
subject { described_class.install_badge }
before do
ENV.delete("HOMEBREW_INSTALL_BADGE")
end
it "returns 🍺 by default" do
expect(subject).to eq "🍺"
end
it "returns the contents of HOMEBREW_INSTALL_BADGE if set" do
ENV["HOMEBREW_INSTALL_BADGE"] = "foo"
expect(subject).to eq "foo"
end
end
end

View File

@ -0,0 +1,66 @@
# frozen_string_literal: true
require "diagnostic"
describe Homebrew::EnvConfig do
subject(:env_config) { described_class }
describe ".env_method_name" do
it "generates method names" do
expect(env_config.env_method_name("HOMEBREW_FOO", {})).to eql("foo")
end
it "generates boolean method names" do
expect(env_config.env_method_name("HOMEBREW_BAR", boolean: true)).to eql("bar?")
end
end
describe ".artifact_domain" do
it "returns value if set" do
ENV["HOMEBREW_ARTIFACT_DOMAIN"] = "https://brew.sh"
expect(env_config.artifact_domain).to eql("https://brew.sh")
end
it "returns nil if empty" do
ENV["HOMEBREW_ARTIFACT_DOMAIN"] = ""
expect(env_config.artifact_domain).to be_nil
end
end
describe ".auto_update_secs" do
it "returns value if set" do
ENV["HOMEBREW_AUTO_UPDATE_SECS"] = "360"
expect(env_config.auto_update_secs).to eql("360")
end
it "returns default if unset" do
ENV["HOMEBREW_AUTO_UPDATE_SECS"] = nil
expect(env_config.auto_update_secs).to eql("300")
end
end
describe ".bat?" do
it "returns true if set" do
ENV["HOMEBREW_BAT"] = "1"
expect(env_config.bat?).to be(true)
end
it "returns false if unset" do
ENV["HOMEBREW_BAT"] = nil
expect(env_config.bat?).to be(false)
end
end
describe ".make_jobs" do
it "returns value if positive" do
ENV["HOMEBREW_MAKE_JOBS"] = "4"
expect(env_config.make_jobs).to eql("4")
end
it "returns default if negative" do
ENV["HOMEBREW_MAKE_JOBS"] = "-1"
expect(Hardware::CPU).to receive(:cores).and_return(16)
expect(env_config.make_jobs).to eql("16")
end
end
end

View File

@ -26,7 +26,8 @@ describe Utils::Bottles::Collector do
end end
it "does not use older tags when requested not to", :needs_macos do it "does not use older tags when requested not to", :needs_macos do
allow(ARGV).to receive(:skip_or_later_bottles?).and_return(true) allow(Homebrew::EnvConfig).to receive(:developer?).and_return(true)
allow(Homebrew::EnvConfig).to receive(:skip_or_later_bottles?).and_return(true)
allow(OS::Mac).to receive(:prerelease?).and_return(true) allow(OS::Mac).to receive(:prerelease?).and_return(true)
subject[:mavericks] = "foo" subject[:mavericks] = "foo"
expect(subject.send(:find_matching_tag, :mavericks)).to eq(:mavericks) expect(subject.send(:find_matching_tag, :mavericks)).to eq(:mavericks)

View File

@ -1,6 +1,5 @@
# frozen_string_literal: true # frozen_string_literal: true
require "emoji"
require "utils/analytics" require "utils/analytics"
require "utils/curl" require "utils/curl"
require "utils/fork" require "utils/fork"
@ -177,7 +176,7 @@ module Kernel
message << tap_message if tap_message message << tap_message if tap_message
message.freeze message.freeze
if ARGV.homebrew_developer? || disable || Homebrew.raise_deprecation_exceptions? if Homebrew::EnvConfig.developer? || disable || Homebrew.raise_deprecation_exceptions?
exception = MethodDeprecatedError.new(message) exception = MethodDeprecatedError.new(message)
exception.set_backtrace(backtrace) exception.set_backtrace(backtrace)
raise exception raise exception
@ -194,20 +193,20 @@ module Kernel
def pretty_installed(f) def pretty_installed(f)
if !$stdout.tty? if !$stdout.tty?
f.to_s f.to_s
elsif Emoji.enabled? elsif Homebrew::EnvConfig.no_emoji?
"#{Tty.bold}#{f} #{Formatter.success("")}#{Tty.reset}"
else
Formatter.success("#{Tty.bold}#{f} (installed)#{Tty.reset}") Formatter.success("#{Tty.bold}#{f} (installed)#{Tty.reset}")
else
"#{Tty.bold}#{f} #{Formatter.success("")}#{Tty.reset}"
end end
end end
def pretty_uninstalled(f) def pretty_uninstalled(f)
if !$stdout.tty? if !$stdout.tty?
f.to_s f.to_s
elsif Emoji.enabled? elsif Homebrew::EnvConfig.no_emoji?
"#{Tty.bold}#{f} #{Formatter.error("")}#{Tty.reset}"
else
Formatter.error("#{Tty.bold}#{f} (uninstalled)#{Tty.reset}") Formatter.error("#{Tty.bold}#{f} (uninstalled)#{Tty.reset}")
else
"#{Tty.bold}#{f} #{Formatter.error("")}#{Tty.reset}"
end end
end end
@ -304,10 +303,7 @@ module Kernel
end end
def which_editor def which_editor
editor = ENV.values_at("HOMEBREW_EDITOR", "HOMEBREW_VISUAL") editor = Homebrew::EnvConfig.editor
.compact
.reject(&:empty?)
.first
return editor if editor return editor if editor
# Find Atom, Sublime Text, Textmate, BBEdit / TextWrangler, or vim # Find Atom, Sublime Text, Textmate, BBEdit / TextWrangler, or vim
@ -331,11 +327,11 @@ module Kernel
end end
def exec_browser(*args) def exec_browser(*args)
browser = ENV["HOMEBREW_BROWSER"] browser = Homebrew::EnvConfig.browser
browser ||= OS::PATH_OPEN if defined?(OS::PATH_OPEN) browser ||= OS::PATH_OPEN if defined?(OS::PATH_OPEN)
return unless browser return unless browser
ENV["DISPLAY"] = ENV["HOMEBREW_DISPLAY"] ENV["DISPLAY"] = Homebrew::EnvConfig.display
safe_system(browser, *args) safe_system(browser, *args)
end end

View File

@ -12,7 +12,7 @@ module Utils
args = [] args = []
# do not load .curlrc unless requested (must be the first argument) # do not load .curlrc unless requested (must be the first argument)
args << "--disable" unless ENV["HOMEBREW_CURLRC"] args << "--disable" unless Homebrew::EnvConfig.curlrc?
args += %W[ args += %W[
--max-time 3 --max-time 3
@ -78,7 +78,7 @@ module Utils
end end
def disabled? def disabled?
return true if ENV["HOMEBREW_NO_ANALYTICS"] return true if Homebrew::EnvConfig.no_analytics?
config_true?(:analyticsdisabled) config_true?(:analyticsdisabled)
end end
@ -308,7 +308,7 @@ module Utils
end end
def formulae_api_json(endpoint) def formulae_api_json(endpoint)
return if ENV["HOMEBREW_NO_ANALYTICS"] || ENV["HOMEBREW_NO_GITHUB_API"] return if Homebrew::EnvConfig.no_analytics? || Homebrew::EnvConfig.no_github_api?
output, = curl_output("--max-time", "5", output, = curl_output("--max-time", "5",
"https://formulae.brew.sh/api/#{endpoint}") "https://formulae.brew.sh/api/#{endpoint}")

View File

@ -17,7 +17,7 @@ def curl_args(*extra_args, show_output: false, user_agent: :default)
args = [] args = []
# do not load .curlrc unless requested (must be the first argument) # do not load .curlrc unless requested (must be the first argument)
args << "--disable" unless ENV["HOMEBREW_CURLRC"] args << "--disable" unless Homebrew::EnvConfig.curlrc?
args << "--globoff" args << "--globoff"
@ -35,12 +35,11 @@ def curl_args(*extra_args, show_output: false, user_agent: :default)
unless show_output unless show_output
args << "--fail" args << "--fail"
args << "--progress-bar" unless Homebrew.args.verbose? args << "--progress-bar" unless Homebrew.args.verbose?
args << "--verbose" if ENV["HOMEBREW_CURL_VERBOSE"] args << "--verbose" if Homebrew::EnvConfig.curl_verbose?
args << "--silent" unless $stdout.tty? args << "--silent" unless $stdout.tty?
end end
# When changing the default value, the manpage has to be updated. args << "--retry" << Homebrew::EnvConfig.curl_retries
args << "--retry" << (ENV["HOMEBREW_CURL_RETRIES"] || "3")
args + extra_args args + extra_args
end end
@ -128,7 +127,7 @@ def curl_check_http_content(url, user_agents: [:default], check_content: false,
return "The URL #{url} is not reachable (HTTP status code #{details[:status]})" return "The URL #{url} is not reachable (HTTP status code #{details[:status]})"
end end
if url.start_with?("https://") && ENV["HOMEBREW_NO_INSECURE_REDIRECT"] && if url.start_with?("https://") && Homebrew::EnvConfig.no_insecure_redirect? &&
!details[:final_url].start_with?("https://") !details[:final_url].start_with?("https://")
return "The URL #{url} redirects back to HTTP" return "The URL #{url} redirects back to HTTP"
end end

View File

@ -103,11 +103,15 @@ module Utils
quiet_system "git", "ls-remote", url quiet_system "git", "ls-remote", url
end end
def self.set_git_name_email! def self.set_git_name_email!(author: true, committer: true)
return unless ENV["HOMEBREW_GIT_NAME"] if Homebrew::EnvConfig.git_name
return unless ENV["HOMEBREW_GIT_EMAIL"] ENV["GIT_AUTHOR_NAME"] = Homebrew::EnvConfig.git_name if author
ENV["GIT_COMMITTER_NAME"] = Homebrew::EnvConfig.git_name if committer
end
ENV["GIT_AUTHOR_NAME"] = ENV["GIT_COMMITTER_NAME"] = ENV["HOMEBREW_GIT_NAME"] return unless Homebrew::EnvConfig.git_email
ENV["GIT_AUTHOR_EMAIL"] = ENV["GIT_COMMITTER_EMAIL"] = ENV["HOMEBREW_GIT_EMAIL"]
ENV["GIT_AUTHOR_EMAIL"] = Homebrew::EnvConfig.git_email if author
ENV["GIT_COMMITTER_EMAIL"] = Homebrew::EnvConfig.git_email if committer
end end
end end

View File

@ -49,7 +49,7 @@ module GitHub
def initialize(github_message) def initialize(github_message)
@github_message = github_message @github_message = github_message
message = +"GitHub #{github_message}:" message = +"GitHub #{github_message}:"
message << if ENV["HOMEBREW_GITHUB_API_TOKEN"] message << if Homebrew::EnvConfig.github_api_token
<<~EOS <<~EOS
HOMEBREW_GITHUB_API_TOKEN may be invalid or expired; check: HOMEBREW_GITHUB_API_TOKEN may be invalid or expired; check:
#{Formatter.url("https://github.com/settings/tokens")} #{Formatter.url("https://github.com/settings/tokens")}
@ -80,15 +80,11 @@ module GitHub
end end
end end
def env_token
ENV["HOMEBREW_GITHUB_API_TOKEN"].presence
end
def env_username_password def env_username_password
return if ENV["HOMEBREW_GITHUB_API_USERNAME"].blank? return unless Homebrew::EnvConfig.github_api_username
return if ENV["HOMEBREW_GITHUB_API_PASSWORD"].blank? return unless Homebrew::EnvConfig.github_api_password
[ENV["HOMEBREW_GITHUB_API_PASSWORD"], ENV["HOMEBREW_GITHUB_API_USERNAME"]] [Homebrew::EnvConfig.github_api_password, Homebrew::EnvConfig.github_api_username]
end end
def keychain_username_password def keychain_username_password
@ -117,12 +113,12 @@ module GitHub
def api_credentials def api_credentials
@api_credentials ||= begin @api_credentials ||= begin
env_token || env_username_password || keychain_username_password Homebrew::EnvConfig.github_api_token || env_username_password || keychain_username_password
end end
end end
def api_credentials_type def api_credentials_type
if env_token if Homebrew::EnvConfig.github_api_token
:env_token :env_token
elsif env_username_password elsif env_username_password
:env_username_password :env_username_password
@ -174,7 +170,7 @@ module GitHub
def open_api(url, data: nil, request_method: nil, scopes: [].freeze, parse_json: true) def open_api(url, data: nil, request_method: nil, scopes: [].freeze, parse_json: true)
# This is a no-op if the user is opting out of using the GitHub API. # This is a no-op if the user is opting out of using the GitHub API.
return block_given? ? yield({}) : {} if ENV["HOMEBREW_NO_GITHUB_API"] return block_given? ? yield({}) : {} if Homebrew::EnvConfig.no_github_api?
args = ["--header", "Accept: application/vnd.github.v3+json", "--write-out", "\n%\{http_code}"] args = ["--header", "Accept: application/vnd.github.v3+json", "--write-out", "\n%\{http_code}"]
args += ["--header", "Accept: application/vnd.github.antiope-preview+json"] args += ["--header", "Accept: application/vnd.github.antiope-preview+json"]

View File

@ -72,8 +72,8 @@ module Tty
end end
def color? def color?
return false if ENV["HOMEBREW_NO_COLOR"] return false if Homebrew::EnvConfig.no_color?
return true if ENV["HOMEBREW_COLOR"] return true if Homebrew::EnvConfig.color?
$stdout.tty? $stdout.tty?
end end

View File

@ -62,8 +62,7 @@ HOMEBREW_LIBRARY="$HOMEBREW_REPOSITORY/Library"
# Whitelist and copy to HOMEBREW_* all variables previously mentioned in # Whitelist and copy to HOMEBREW_* all variables previously mentioned in
# manpage or used elsewhere by Homebrew. # manpage or used elsewhere by Homebrew.
for VAR in AWS_ACCESS_KEY_ID AWS_SECRET_ACCESS_KEY BINTRAY_USER BINTRAY_KEY \ for VAR in BROWSER DISPLAY EDITOR NO_COLOR PATH
BROWSER DISPLAY EDITOR GIT NO_COLOR PATH VISUAL
do do
# Skip if variable value is empty. # Skip if variable value is empty.
[[ -z "${!VAR}" ]] && continue [[ -z "${!VAR}" ]] && continue
@ -74,6 +73,12 @@ do
export "$VAR_NEW"="${!VAR}" export "$VAR_NEW"="${!VAR}"
done done
# Use VISUAL if HOMEBREW_EDITOR and EDITOR are unset.
if [[ -z "$HOMEBREW_EDITOR" && -n "$VISUAL" ]]
then
export HOMEBREW_EDITOR="$VISUAL"
fi
# Set CI variable for GitHub Actions, Azure Pipelines, Jenkins # Set CI variable for GitHub Actions, Azure Pipelines, Jenkins
# (Set by default on Circle and Travis CI) # (Set by default on Circle and Travis CI)
if [[ -n "$GITHUB_ACTIONS" || -n "$TF_BUILD" || -n "$JENKINS_HOME" ]] if [[ -n "$GITHUB_ACTIONS" || -n "$TF_BUILD" || -n "$JENKINS_HOME" ]]
@ -90,7 +95,7 @@ then
# Filter all but the specific variables. # Filter all but the specific variables.
for VAR in HOME SHELL PATH TERM TERMINFO COLUMNS DISPLAY LOGNAME USER CI SSH_AUTH_SOCK SUDO_ASKPASS \ for VAR in HOME SHELL PATH TERM TERMINFO COLUMNS DISPLAY LOGNAME USER CI SSH_AUTH_SOCK SUDO_ASKPASS \
http_proxy https_proxy ftp_proxy no_proxy all_proxy HTTPS_PROXY FTP_PROXY ALL_PROXY \ http_proxy https_proxy ftp_proxy no_proxy all_proxy HTTPS_PROXY FTP_PROXY ALL_PROXY \
"${!HOMEBREW_@}" "${!TRAVIS_@}" "${!HOMEBREW_@}"
do do
# Skip if variable value is empty. # Skip if variable value is empty.
[[ -z "${!VAR}" ]] && continue [[ -z "${!VAR}" ]] && continue

View File

@ -1176,204 +1176,206 @@ Note that environment variables must have a value set to be detected. For exampl
`export HOMEBREW_NO_INSECURE_REDIRECT`. `export HOMEBREW_NO_INSECURE_REDIRECT`.
* `HOMEBREW_ARCH`: * `HOMEBREW_ARCH`:
Linux only: If set, Homebrew will pass the set value to type name to the compiler's Linux only: Homebrew will pass the set value to type name to the compiler's `-march` option.
`-march` option instead of using the default (`-march=native`).
*Default:* `native`.
* `HOMEBREW_ARTIFACT_DOMAIN`: * `HOMEBREW_ARTIFACT_DOMAIN`:
If set, instructs Homebrew to prefix all download URLs, including those for bottles, Instructs Homebrew to prefix all download URLs, including those for bottles, with this variable. For example, `HOMEBREW_ARTIFACT_DOMAIN=http://localhost:8080` will cause a formula with the URL `https://example.com/foo.tar.gz` to instead download from `http://localhost:8080/example.com/foo.tar.gz`.
with this variable. For example, `HOMEBREW_ARTIFACT_DOMAIN=http://localhost:8080`
will cause a formula with the URL `https://example.com/foo.tar.gz` to instead
download from `http://localhost:8080/example.com/foo.tar.gz`.
* `HOMEBREW_AUTO_UPDATE_SECS`: * `HOMEBREW_AUTO_UPDATE_SECS`:
If set, Homebrew will only check for autoupdates once per this seconds interval. Homebrew will only check for autoupdates once per this seconds interval.
*Default:* `300`. *Default:* `300`.
* `HOMEBREW_AWS_ACCESS_KEY_ID`, `HOMEBREW_AWS_SECRET_ACCESS_KEY`:
When using the `S3` download strategy, Homebrew will look in
these variables for access credentials (see
<https://docs.aws.amazon.com/cli/latest/userguide/cli-chap-getting-started.html#cli-environment>
to retrieve these access credentials from AWS). If they are not set,
the `S3` download strategy will download with a public (unsigned) URL.
* `HOMEBREW_BAT`: * `HOMEBREW_BAT`:
If set, Homebrew will use `bat` for the `brew cat` command. Homebrew will use `bat` for the `brew cat` command.
* `HOMEBREW_BINTRAY_KEY`:
Homebrew uses this API key when accessing the Bintray API (where bottles are stored).
* `HOMEBREW_BINTRAY_USER`:
Homebrew uses this username when accessing the Bintray API (where bottles are stored).
* `HOMEBREW_BOTTLE_DOMAIN`: * `HOMEBREW_BOTTLE_DOMAIN`:
By default, Homebrew uses `https://homebrew.bintray.com/` as its download Instructs Homebrew to use the specified URL as its download mirror for bottles. For example, `HOMEBREW_BOTTLE_DOMAIN=http://localhost:8080` will cause all bottles to download from the prefix `http://localhost:8080/`.
mirror for bottles. If set, instructs Homebrew to instead use the specified
URL. For example, `HOMEBREW_BOTTLE_DOMAIN=http://localhost:8080` will *Default:* macOS: `https://homebrew.bintray.com/`, Linux: `https://linuxbrew.bintray.com/`.
cause all bottles to download from the prefix `http://localhost:8080/`.
* `HOMEBREW_BREW_GIT_REMOTE`: * `HOMEBREW_BREW_GIT_REMOTE`:
By default, Homebrew uses `https://github.com/Homebrew/brew` as its Instructs Homebrew to use the specified URL as its Homebrew/brew `git`(1) remote.
Homebrew/brew `git`(1) remote. If set, instructs Homebrew to instead use
the specified URL. *Default:* `https://github.com/Homebrew/brew`.
* `HOMEBREW_BROWSER`: * `HOMEBREW_BROWSER`:
If set, Homebrew uses this setting as the browser when opening project Homebrew uses this setting as the browser when opening project homepages.
homepages, instead of the OS default browser.
*Default:* `$BROWSER` or the OS's default browser.
* `HOMEBREW_CACHE`: * `HOMEBREW_CACHE`:
If set, instructs Homebrew to use the specified directory as the download cache. Instructs Homebrew to use the specified directory as the download cache.
*Default:* `~/Library/Caches/Homebrew`. *Default:* macOS: `$HOME/Library/Caches/Homebrew`, Linux: `$XDG_CACHE_HOME/Homebrew` or `$HOME/.cache/Homebrew`.
* `HOMEBREW_COLOR`:
Homebrew force colour output on non-TTY outputs.
* `HOMEBREW_CORE_GIT_REMOTE`: * `HOMEBREW_CORE_GIT_REMOTE`:
By default, Homebrew uses `https://github.com/Homebrew/homebrew-core` (or instructs Homebrew to use the specified URL as its Homebrew/homebrew-core `git`(1) remote.
`https://github.com/Homebrew/linuxbrew-core`) as its Homebrew/homebrew-core
`git`(1) remote. If set, instructs Homebrew to instead use the specified URL. *Default:* macOS: `https://github.com/Homebrew/homebrew-core`, Linux: `https://github.com/Homebrew/linuxbrew-core`.
* `HOMEBREW_CURLRC`: * `HOMEBREW_CURLRC`:
If set, Homebrew will not pass `--disable` when invoking `curl`(1), which disables Homebrew will not pass `--disable` when invoking `curl`(1), which disables the use of `curlrc`.
the use of `curlrc`.
* `HOMEBREW_CURL_VERBOSE`:
If set, Homebrew will pass `--verbose` when invoking `curl`(1).
* `HOMEBREW_CURL_RETRIES`: * `HOMEBREW_CURL_RETRIES`:
If set, Homebrew will pass the given retry count to `--retry` when invoking `curl`(1). Homebrew will pass the given retry count to `--retry` when invoking `curl`(1).
By default, `curl`(1) is invoked with `--retry 3`.
* `HOMEBREW_DEBUG`: *Default:* `3`.
If set, any commands that can emit debugging information will do so.
* `HOMEBREW_CURL_VERBOSE`:
Homebrew will pass `--verbose` when invoking `curl`(1).
* `HOMEBREW_DEVELOPER`: * `HOMEBREW_DEVELOPER`:
If set, Homebrew will tweak behaviour to be more relevant for Homebrew Homebrew will tweak behaviour to be more relevant for Homebrew developers (active or budding), e.g. turning warnings into errors.
developers (active or budding), e.g. turning warnings into errors.
* `HOMEBREW_DISABLE_LOAD_FORMULA`:
Homebrew will refuse to load formulae. This is useful when formulae are not trusted (such as in pull requests).
* `HOMEBREW_DISPLAY`: * `HOMEBREW_DISPLAY`:
If set, Homebrew will use this X11 display when opening a page in a browser, Homebrew will use this X11 display when opening a page in a browser, for example with `brew home`. Primarily useful on Linux.
for example with `brew home`. Primarily useful on Linux.
*Default:* the value of the user's `DISPLAY` environment variable. *Default:* `$DISPLAY`.
* `HOMEBREW_DISPLAY_INSTALL_TIMES`: * `HOMEBREW_DISPLAY_INSTALL_TIMES`:
If set, Homebrew will print install times for each formula at the end of the run. Homebrew will print install times for each formula at the end of the run.
* `HOMEBREW_EDITOR`: * `HOMEBREW_EDITOR`:
If set, Homebrew will use this editor when editing a single formula, or Homebrew will use this editor when editing a single formula, or several formulae in the same directory.
several formulae in the same directory.
*Note:* `brew edit` will open all of Homebrew as discontinuous files and *Note:* `brew edit` will open all of Homebrew as discontinuous files and directories. Visual Studio Code can handle this correctly in project mode, but many editors will do strange things in this case.
directories. TextMate can handle this correctly in project mode, but many
editors will do strange things in this case. *Default:* `$EDITOR` or `$VISUAL`.
* `HOMEBREW_FAIL_LOG_LINES`:
Homebrew will output this many lines of output on formula `system` failures.
*Default:* `15`.
* `HOMEBREW_FORCE_BREWED_CURL`: * `HOMEBREW_FORCE_BREWED_CURL`:
If set, Homebrew will always use a Homebrew-installed `curl` rather than the Homebrew will always use a Homebrew-installed `curl`(1) rather than the system version. Automatically set if the system version of `curl` is too old.
system version. Automatically set if the system version of `curl` is too old.
* `HOMEBREW_FORCE_VENDOR_RUBY`:
If set, Homebrew will always use its vendored, relocatable Ruby version
even if the system version of Ruby is new enough.
* `HOMEBREW_FORCE_BREWED_GIT`: * `HOMEBREW_FORCE_BREWED_GIT`:
If set, Homebrew will always use a Homebrew-installed `git`(1) rather than the Homebrew will always use a Homebrew-installed `git`(1) rather than the system version. Automatically set if the system version of `git` is too old.
system version. Automatically set if the system version of `git` is too old.
* `HOMEBREW_FORCE_HOMEBREW_ON_LINUX`:
Homebrew running on Linux will use URLs for Homebrew on macOS. This is useful when mergingpull requests on Linux for macOS.
* `HOMEBREW_FORCE_VENDOR_RUBY`:
Homebrew will always use its vendored, relocatable Ruby version even if the system version of Ruby is new enough.
* `HOMEBREW_GITHUB_API_PASSWORD`:
GitHub password for authentication with the GitHub API, used by Homebrew for featuressuch as `brew search`. We strongly recommend using `HOMEBREW_GITHUB_API_TOKEN` instead.
* `HOMEBREW_GITHUB_API_TOKEN`: * `HOMEBREW_GITHUB_API_TOKEN`:
A personal access token for the GitHub API, used by Homebrew for features A personal access token for the GitHub API, used by Homebrew for features such as `brew search`. You can create one at <https://github.com/settings/tokens>. If set, GitHub will allow you a greater number of API requests. For more information, see: <https://developer.github.com/v3/#rate-limiting>
such as `brew search`. You can create one at <https://github.com/settings/tokens>.
If set, GitHub will allow you a greater number of API requests. For more
information, see: <https://developer.github.com/v3/#rate-limiting>
*Note:* Homebrew doesn't require permissions for any of the scopes. *Note:* Homebrew doesn't require permissions for any of the scopes.
* `HOMEBREW_GITHUB_API_USERNAME`:
GitHub username for authentication with the GitHub API, used by Homebrew for features such as `brew search`. We strongly recommend using `HOMEBREW_GITHUB_API_TOKEN` instead.
* `HOMEBREW_GIT_EMAIL`:
Homebrew will set the Git author and committer name to this value.
* `HOMEBREW_GIT_NAME`:
Homebrew will set the Git author and committer email to this value.
* `HOMEBREW_INSTALL_BADGE`: * `HOMEBREW_INSTALL_BADGE`:
Text printed before the installation summary of each successful build. Text printed before the installation summary of each successful build.
*Default:* the beer emoji. *Default:* The "Beer Mug" emoji.
* `HOMEBREW_LOGS`: * `HOMEBREW_LOGS`:
If set, Homebrew will use the specified directory to store log files. IHomebrew will use the specified directory to store log files.
*Default:* macOS: `$HOME/Library/Logs/Homebrew`, Linux: `$XDG_CACHE_HOME/Homebrew/Logs` or `$HOME/.cache/Homebrew/Logs`.
* `HOMEBREW_MAKE_JOBS`: * `HOMEBREW_MAKE_JOBS`:
If set, instructs Homebrew to use the value of `HOMEBREW_MAKE_JOBS` as Instructs Homebrew to use the value of `HOMEBREW_MAKE_JOBS` as the number of parallel jobs to run when building with `make`(1).
the number of parallel jobs to run when building with `make`(1).
*Default:* the number of available CPU cores. *Default:* The number of available CPU cores.
* `HOMEBREW_NO_ANALYTICS`: * `HOMEBREW_NO_ANALYTICS`:
If set, Homebrew will not send analytics. See: <https://docs.brew.sh/Analytics> Homebrew will not send analytics. See: <https://docs.brew.sh/Analytics>.
* `HOMEBREW_NO_AUTO_UPDATE`: * `HOMEBREW_NO_AUTO_UPDATE`:
If set, Homebrew will not auto-update before running `brew install`, Homebrew will not auto-update before running `brew install`, `brew upgrade` or `brew tap`.
`brew upgrade` or `brew tap`.
* `HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK`: * `HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK`:
If set, Homebrew will fail on the failure of installation from a bottle Homebrew will fail on the failure of installation from a bottle rather than falling back to building from source.
rather than falling back to building from source.
* `HOMEBREW_NO_COLOR`: * `HOMEBREW_NO_COLOR`:
If set, Homebrew will not print text with colour added. Homebrew will not print text with colour added.
*Default:* `$NO_COLOR`.
* `HOMEBREW_NO_COMPAT`:
Homebrew disables all use of legacy compatibility code.
* `HOMEBREW_NO_EMOJI`: * `HOMEBREW_NO_EMOJI`:
If set, Homebrew will not print the `HOMEBREW_INSTALL_BADGE` on a Homebrew will not print the `HOMEBREW_INSTALL_BADGE` on a successful build.
successful build.
*Note:* Homebrew will only try to print emoji on OS X Lion or newer. *Note:* Homebrew will only try to print emoji on OS X Lion or newer.
* `HOMEBREW_NO_INSECURE_REDIRECT`:
If set, Homebrew will not permit redirects from secure HTTPS
to insecure HTTP.
While ensuring your downloads are fully secure, this is likely
to cause from-source SourceForge, some GNU & GNOME based
formulae to fail to download.
* `HOMEBREW_NO_GITHUB_API`: * `HOMEBREW_NO_GITHUB_API`:
If set, Homebrew will not use the GitHub API, e.g. for searches or Homebrew will not use the GitHub API, e.g. for searches or fetching relevant issues on a failed install.
fetching relevant issues on a failed install.
* `HOMEBREW_NO_INSECURE_REDIRECT`:
Homebrew will not permit redirects from secure HTTPS to insecure HTTP.
*Note:* While ensuring your downloads are fully secure, this is likely to cause from-source SourceForge, some GNU & GNOME based formulae to fail to download.
* `HOMEBREW_NO_INSTALL_CLEANUP`: * `HOMEBREW_NO_INSTALL_CLEANUP`:
If set, `brew install`, `brew upgrade` and `brew reinstall` will never `brew install`, `brew upgrade` and `brew reinstall` will never automatically cleanup installed/upgraded/reinstalled formulae or all formulae every 30 days.
automatically cleanup the installed/upgraded/reinstalled formulae or all
formulae every 30 days.
* `HOMEBREW_PRY`: * `HOMEBREW_PRY`:
If set, Homebrew will use Pry for the `brew irb` command. Homebrew will use Pry for the `brew irb` command.
* `HOMEBREW_SKIP_OR_LATER_BOTTLES`:
Along with `HOMEBREW_DEVELOPER` Homebrew will not use bottles from older versions of macOS. This is useful in Homebrew development on new macOS versions.
* `HOMEBREW_SVN`: * `HOMEBREW_SVN`:
When exporting from Subversion, Homebrew will use `HOMEBREW_SVN` if set, Forces Homebrew to use a particular `svn` binary. Otherwise, a Homebrew-built Subversion if installed, or the system-provided binary.
a Homebrew-built Subversion if installed, or the system-provided binary.
Set this to force Homebrew to use a particular `svn` binary.
* `HOMEBREW_TEMP`: * `HOMEBREW_TEMP`:
If set, instructs Homebrew to use `HOMEBREW_TEMP` as the temporary directory Instructs Homebrew to use `HOMEBREW_TEMP` as the temporary directory for building packages. This may be needed if your system temp directory and Homebrew prefix are on different volumes, as macOS has trouble moving symlinks across volumes when the targetdoes not yet exist. This issue typically occurs when using FileVault or custom SSDconfigurations.
for building packages. This may be needed if your system temp directory and
Homebrew prefix are on different volumes, as macOS has trouble moving
symlinks across volumes when the target does not yet exist.
This issue typically occurs when using FileVault or custom SSD configurations. *Default:* macOS: `/private/tmp`, Linux: `/tmp`.
* `HOMEBREW_UPDATE_TO_TAG`: * `HOMEBREW_UPDATE_TO_TAG`:
If set, instructs Homebrew to always use the latest stable tag (even if Instructs Homebrew to always use the latest stable tag (even if developer commands have been run).
developer commands have been run).
* `HOMEBREW_VERBOSE`: * `HOMEBREW_VERBOSE`:
If set, Homebrew always assumes `--verbose` when running commands. Homebrew always assumes `--verbose` when running commands.
* `http_proxy`: * `HOMEBREW_VERBOSE_USING_DOTS`:
Sets the HTTP proxy to be used by `curl`, `git` and `svn` when downloading Homebrew's verbose output will print a `.` no more than once a minute. This can be useful to avoid long-running Homebrew commands being killed due to no output.
through Homebrew.
* `https_proxy`:
Sets the HTTPS proxy to be used by `curl`, `git` and `svn` when downloading
through Homebrew.
* `all_proxy`: * `all_proxy`:
Sets the SOCKS5 proxy to be used by `curl`, `git` and `svn` when downloading Sets the SOCKS5 proxy to be used by `curl`(1), `git`(1) and `svn`(1) when downloading through Homebrew.
through Homebrew.
* `ftp_proxy`: * `ftp_proxy`:
Sets the FTP proxy to be used by `curl`, `git` and `svn` when downloading Sets the FTP proxy to be used by `curl`(1), `git`(1) and `svn`(1) when downloading through Homebrew.
through Homebrew.
* `http_proxy`:
Sets the HTTP proxy to be used by `curl`(1), `git`(1) and `svn`(1) when downloading through Homebrew.
* `https_proxy`:
Sets the HTTPS proxy to be used by `curl`(1), `git`(1) and `svn`(1) when downloading through Homebrew.
* `no_proxy`: * `no_proxy`:
Sets the comma-separated list of hostnames and domain names that should be excluded Sets the comma-separated list of hostnames and domain names that should be excluded from proxying by `curl`(1), `git`(1) and `svn`(1) when downloading through Homebrew.
from proxying by `curl`, `git` and `svn` when downloading through Homebrew.
## USING HOMEBREW BEHIND A PROXY ## USING HOMEBREW BEHIND A PROXY

View File

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BREW\-CASK" "1" "March 2020" "Homebrew" "brew-cask" .TH "BREW\-CASK" "1" "April 2020" "Homebrew" "brew-cask"
. .
.SH "NAME" .SH "NAME"
\fBbrew\-cask\fR \- a friendly binary installer for macOS \fBbrew\-cask\fR \- a friendly binary installer for macOS

View File

@ -1,7 +1,7 @@
.\" generated with Ronn/v0.7.3 .\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3 .\" http://github.com/rtomayko/ronn/tree/0.7.3
. .
.TH "BREW" "1" "March 2020" "Homebrew" "brew" .TH "BREW" "1" "April 2020" "Homebrew" "brew"
. .
.SH "NAME" .SH "NAME"
\fBbrew\fR \- The Missing Package Manager for macOS \fBbrew\fR \- The Missing Package Manager for macOS
@ -1492,99 +1492,143 @@ Note that environment variables must have a value set to be detected\. For examp
. .
.TP .TP
\fBHOMEBREW_ARCH\fR \fBHOMEBREW_ARCH\fR
Linux only: If set, Homebrew will pass the set value to type name to the compiler\'s \fB\-march\fR option instead of using the default (\fB\-march=native\fR)\. Linux only: Homebrew will pass the set value to type name to the compiler\'s \fB\-march\fR option\.
.
.IP
\fIDefault:\fR \fBnative\fR\.
. .
.TP .TP
\fBHOMEBREW_ARTIFACT_DOMAIN\fR \fBHOMEBREW_ARTIFACT_DOMAIN\fR
If set, instructs Homebrew to prefix all download URLs, including those for bottles, with this variable\. For example, \fBHOMEBREW_ARTIFACT_DOMAIN=http://localhost:8080\fR will cause a formula with the URL \fBhttps://example\.com/foo\.tar\.gz\fR to instead download from \fBhttp://localhost:8080/example\.com/foo\.tar\.gz\fR\. Instructs Homebrew to prefix all download URLs, including those for bottles, with this variable\. For example, \fBHOMEBREW_ARTIFACT_DOMAIN=http://localhost:8080\fR will cause a formula with the URL \fBhttps://example\.com/foo\.tar\.gz\fR to instead download from \fBhttp://localhost:8080/example\.com/foo\.tar\.gz\fR\.
. .
.TP .TP
\fBHOMEBREW_AUTO_UPDATE_SECS\fR \fBHOMEBREW_AUTO_UPDATE_SECS\fR
If set, Homebrew will only check for autoupdates once per this seconds interval\. Homebrew will only check for autoupdates once per this seconds interval\.
. .
.IP .IP
\fIDefault:\fR \fB300\fR\. \fIDefault:\fR \fB300\fR\.
. .
.TP .TP
\fBHOMEBREW_AWS_ACCESS_KEY_ID\fR, \fBHOMEBREW_AWS_SECRET_ACCESS_KEY\fR \fBHOMEBREW_BAT\fR
When using the \fBS3\fR download strategy, Homebrew will look in these variables for access credentials (see \fIhttps://docs\.aws\.amazon\.com/cli/latest/userguide/cli\-chap\-getting\-started\.html#cli\-environment\fR to retrieve these access credentials from AWS)\. If they are not set, the \fBS3\fR download strategy will download with a public (unsigned) URL\. Homebrew will use \fBbat\fR for the \fBbrew cat\fR command\.
. .
.TP .TP
\fBHOMEBREW_BAT\fR \fBHOMEBREW_BINTRAY_KEY\fR
If set, Homebrew will use \fBbat\fR for the \fBbrew cat\fR command\. Homebrew uses this API key when accessing the Bintray API (where bottles are stored)\.
.
.TP
\fBHOMEBREW_BINTRAY_USER\fR
Homebrew uses this username when accessing the Bintray API (where bottles are stored)\.
. .
.TP .TP
\fBHOMEBREW_BOTTLE_DOMAIN\fR \fBHOMEBREW_BOTTLE_DOMAIN\fR
By default, Homebrew uses \fBhttps://homebrew\.bintray\.com/\fR as its download mirror for bottles\. If set, instructs Homebrew to instead use the specified URL\. For example, \fBHOMEBREW_BOTTLE_DOMAIN=http://localhost:8080\fR will cause all bottles to download from the prefix \fBhttp://localhost:8080/\fR\. Instructs Homebrew to use the specified URL as its download mirror for bottles\. For example, \fBHOMEBREW_BOTTLE_DOMAIN=http://localhost:8080\fR will cause all bottles to download from the prefix \fBhttp://localhost:8080/\fR\.
.
.IP
\fIDefault:\fR macOS: \fBhttps://homebrew\.bintray\.com/\fR, Linux: \fBhttps://linuxbrew\.bintray\.com/\fR\.
. .
.TP .TP
\fBHOMEBREW_BREW_GIT_REMOTE\fR \fBHOMEBREW_BREW_GIT_REMOTE\fR
By default, Homebrew uses \fBhttps://github\.com/Homebrew/brew\fR as its Homebrew/brew \fBgit\fR(1) remote\. If set, instructs Homebrew to instead use the specified URL\. Instructs Homebrew to use the specified URL as its Homebrew/brew \fBgit\fR(1) remote\.
.
.IP
\fIDefault:\fR \fBhttps://github\.com/Homebrew/brew\fR\.
. .
.TP .TP
\fBHOMEBREW_BROWSER\fR \fBHOMEBREW_BROWSER\fR
If set, Homebrew uses this setting as the browser when opening project homepages, instead of the OS default browser\. Homebrew uses this setting as the browser when opening project homepages\.
.
.IP
\fIDefault:\fR \fB$BROWSER\fR or the OS\'s default browser\.
. .
.TP .TP
\fBHOMEBREW_CACHE\fR \fBHOMEBREW_CACHE\fR
If set, instructs Homebrew to use the specified directory as the download cache\. Instructs Homebrew to use the specified directory as the download cache\.
. .
.IP .IP
\fIDefault:\fR \fB~/Library/Caches/Homebrew\fR\. \fIDefault:\fR macOS: \fB$HOME/Library/Caches/Homebrew\fR, Linux: \fB$XDG_CACHE_HOME/Homebrew\fR or \fB$HOME/\.cache/Homebrew\fR\.
.
.TP
\fBHOMEBREW_COLOR\fR
Homebrew force colour output on non\-TTY outputs\.
. .
.TP .TP
\fBHOMEBREW_CORE_GIT_REMOTE\fR \fBHOMEBREW_CORE_GIT_REMOTE\fR
By default, Homebrew uses \fBhttps://github\.com/Homebrew/homebrew\-core\fR (or \fBhttps://github\.com/Homebrew/linuxbrew\-core\fR) as its Homebrew/homebrew\-core \fBgit\fR(1) remote\. If set, instructs Homebrew to instead use the specified URL\. instructs Homebrew to use the specified URL as its Homebrew/homebrew\-core \fBgit\fR(1) remote\.
.
.IP
\fIDefault:\fR macOS: \fBhttps://github\.com/Homebrew/homebrew\-core\fR, Linux: \fBhttps://github\.com/Homebrew/linuxbrew\-core\fR\.
. .
.TP .TP
\fBHOMEBREW_CURLRC\fR \fBHOMEBREW_CURLRC\fR
If set, Homebrew will not pass \fB\-\-disable\fR when invoking \fBcurl\fR(1), which disables the use of \fBcurlrc\fR\. Homebrew will not pass \fB\-\-disable\fR when invoking \fBcurl\fR(1), which disables the use of \fBcurlrc\fR\.
.
.TP
\fBHOMEBREW_CURL_VERBOSE\fR
If set, Homebrew will pass \fB\-\-verbose\fR when invoking \fBcurl\fR(1)\.
. .
.TP .TP
\fBHOMEBREW_CURL_RETRIES\fR \fBHOMEBREW_CURL_RETRIES\fR
If set, Homebrew will pass the given retry count to \fB\-\-retry\fR when invoking \fBcurl\fR(1)\. By default, \fBcurl\fR(1) is invoked with \fB\-\-retry 3\fR\. Homebrew will pass the given retry count to \fB\-\-retry\fR when invoking \fBcurl\fR(1)\.
.
.IP
\fIDefault:\fR \fB3\fR\.
. .
.TP .TP
\fBHOMEBREW_DEBUG\fR \fBHOMEBREW_CURL_VERBOSE\fR
If set, any commands that can emit debugging information will do so\. Homebrew will pass \fB\-\-verbose\fR when invoking \fBcurl\fR(1)\.
. .
.TP .TP
\fBHOMEBREW_DEVELOPER\fR \fBHOMEBREW_DEVELOPER\fR
If set, Homebrew will tweak behaviour to be more relevant for Homebrew developers (active or budding), e\.g\. turning warnings into errors\. Homebrew will tweak behaviour to be more relevant for Homebrew developers (active or budding), e\.g\. turning warnings into errors\.
.
.TP
\fBHOMEBREW_DISABLE_LOAD_FORMULA\fR
Homebrew will refuse to load formulae\. This is useful when formulae are not trusted (such as in pull requests)\.
. .
.TP .TP
\fBHOMEBREW_DISPLAY\fR \fBHOMEBREW_DISPLAY\fR
If set, Homebrew will use this X11 display when opening a page in a browser, for example with \fBbrew home\fR\. Primarily useful on Linux\. Homebrew will use this X11 display when opening a page in a browser, for example with \fBbrew home\fR\. Primarily useful on Linux\.
. .
.IP .IP
\fIDefault:\fR the value of the user\'s \fBDISPLAY\fR environment variable\. \fIDefault:\fR \fB$DISPLAY\fR\.
. .
.TP .TP
\fBHOMEBREW_DISPLAY_INSTALL_TIMES\fR \fBHOMEBREW_DISPLAY_INSTALL_TIMES\fR
If set, Homebrew will print install times for each formula at the end of the run\. Homebrew will print install times for each formula at the end of the run\.
. .
.TP .TP
\fBHOMEBREW_EDITOR\fR \fBHOMEBREW_EDITOR\fR
If set, Homebrew will use this editor when editing a single formula, or several formulae in the same directory\. Homebrew will use this editor when editing a single formula, or several formulae in the same directory\.
. .
.IP .IP
\fINote:\fR \fBbrew edit\fR will open all of Homebrew as discontinuous files and directories\. TextMate can handle this correctly in project mode, but many editors will do strange things in this case\. \fINote:\fR \fBbrew edit\fR will open all of Homebrew as discontinuous files and directories\. Visual Studio Code can handle this correctly in project mode, but many editors will do strange things in this case\.
.
.IP
\fIDefault:\fR \fB$EDITOR\fR or \fB$VISUAL\fR\.
.
.TP
\fBHOMEBREW_FAIL_LOG_LINES\fR
Homebrew will output this many lines of output on formula \fBsystem\fR failures\.
.
.IP
\fIDefault:\fR \fB15\fR\.
. .
.TP .TP
\fBHOMEBREW_FORCE_BREWED_CURL\fR \fBHOMEBREW_FORCE_BREWED_CURL\fR
If set, Homebrew will always use a Homebrew\-installed \fBcurl\fR rather than the system version\. Automatically set if the system version of \fBcurl\fR is too old\. Homebrew will always use a Homebrew\-installed \fBcurl\fR(1) rather than the system version\. Automatically set if the system version of \fBcurl\fR is too old\.
.
.TP
\fBHOMEBREW_FORCE_VENDOR_RUBY\fR
If set, Homebrew will always use its vendored, relocatable Ruby version even if the system version of Ruby is new enough\.
. .
.TP .TP
\fBHOMEBREW_FORCE_BREWED_GIT\fR \fBHOMEBREW_FORCE_BREWED_GIT\fR
If set, Homebrew will always use a Homebrew\-installed \fBgit\fR(1) rather than the system version\. Automatically set if the system version of \fBgit\fR is too old\. Homebrew will always use a Homebrew\-installed \fBgit\fR(1) rather than the system version\. Automatically set if the system version of \fBgit\fR is too old\.
.
.TP
\fBHOMEBREW_FORCE_HOMEBREW_ON_LINUX\fR
Homebrew running on Linux will use URLs for Homebrew on macOS\. This is useful when mergingpull requests on Linux for macOS\.
.
.TP
\fBHOMEBREW_FORCE_VENDOR_RUBY\fR
Homebrew will always use its vendored, relocatable Ruby version even if the system version of Ruby is new enough\.
.
.TP
\fBHOMEBREW_GITHUB_API_PASSWORD\fR
GitHub password for authentication with the GitHub API, used by Homebrew for featuressuch as \fBbrew search\fR\. We strongly recommend using \fBHOMEBREW_GITHUB_API_TOKEN\fR instead\.
. .
.TP .TP
\fBHOMEBREW_GITHUB_API_TOKEN\fR \fBHOMEBREW_GITHUB_API_TOKEN\fR
@ -1594,106 +1638,133 @@ A personal access token for the GitHub API, used by Homebrew for features such a
\fINote:\fR Homebrew doesn\'t require permissions for any of the scopes\. \fINote:\fR Homebrew doesn\'t require permissions for any of the scopes\.
. .
.TP .TP
\fBHOMEBREW_GITHUB_API_USERNAME\fR
GitHub username for authentication with the GitHub API, used by Homebrew for features such as \fBbrew search\fR\. We strongly recommend using \fBHOMEBREW_GITHUB_API_TOKEN\fR instead\.
.
.TP
\fBHOMEBREW_GIT_EMAIL\fR
Homebrew will set the Git author and committer name to this value\.
.
.TP
\fBHOMEBREW_GIT_NAME\fR
Homebrew will set the Git author and committer email to this value\.
.
.TP
\fBHOMEBREW_INSTALL_BADGE\fR \fBHOMEBREW_INSTALL_BADGE\fR
Text printed before the installation summary of each successful build\. Text printed before the installation summary of each successful build\.
. .
.IP .IP
\fIDefault:\fR the beer emoji\. \fIDefault:\fR The "Beer Mug" emoji\.
. .
.TP .TP
\fBHOMEBREW_LOGS\fR \fBHOMEBREW_LOGS\fR
If set, Homebrew will use the specified directory to store log files\. IHomebrew will use the specified directory to store log files\.
.
.IP
\fIDefault:\fR macOS: \fB$HOME/Library/Logs/Homebrew\fR, Linux: \fB$XDG_CACHE_HOME/Homebrew/Logs\fR or \fB$HOME/\.cache/Homebrew/Logs\fR\.
. .
.TP .TP
\fBHOMEBREW_MAKE_JOBS\fR \fBHOMEBREW_MAKE_JOBS\fR
If set, instructs Homebrew to use the value of \fBHOMEBREW_MAKE_JOBS\fR as the number of parallel jobs to run when building with \fBmake\fR(1)\. Instructs Homebrew to use the value of \fBHOMEBREW_MAKE_JOBS\fR as the number of parallel jobs to run when building with \fBmake\fR(1)\.
. .
.IP .IP
\fIDefault:\fR the number of available CPU cores\. \fIDefault:\fR The number of available CPU cores\.
. .
.TP .TP
\fBHOMEBREW_NO_ANALYTICS\fR \fBHOMEBREW_NO_ANALYTICS\fR
If set, Homebrew will not send analytics\. See: \fIhttps://docs\.brew\.sh/Analytics\fR Homebrew will not send analytics\. See: \fIhttps://docs\.brew\.sh/Analytics\fR\.
. .
.TP .TP
\fBHOMEBREW_NO_AUTO_UPDATE\fR \fBHOMEBREW_NO_AUTO_UPDATE\fR
If set, Homebrew will not auto\-update before running \fBbrew install\fR, \fBbrew upgrade\fR or \fBbrew tap\fR\. Homebrew will not auto\-update before running \fBbrew install\fR, \fBbrew upgrade\fR or \fBbrew tap\fR\.
. .
.TP .TP
\fBHOMEBREW_NO_BOTTLE_SOURCE_FALLBACK\fR \fBHOMEBREW_NO_BOTTLE_SOURCE_FALLBACK\fR
If set, Homebrew will fail on the failure of installation from a bottle rather than falling back to building from source\. Homebrew will fail on the failure of installation from a bottle rather than falling back to building from source\.
. .
.TP .TP
\fBHOMEBREW_NO_COLOR\fR \fBHOMEBREW_NO_COLOR\fR
If set, Homebrew will not print text with colour added\. Homebrew will not print text with colour added\.
.
.IP
\fIDefault:\fR \fB$NO_COLOR\fR\.
.
.TP
\fBHOMEBREW_NO_COMPAT\fR
Homebrew disables all use of legacy compatibility code\.
. .
.TP .TP
\fBHOMEBREW_NO_EMOJI\fR \fBHOMEBREW_NO_EMOJI\fR
If set, Homebrew will not print the \fBHOMEBREW_INSTALL_BADGE\fR on a successful build\. Homebrew will not print the \fBHOMEBREW_INSTALL_BADGE\fR on a successful build\.
. .
.IP .IP
\fINote:\fR Homebrew will only try to print emoji on OS X Lion or newer\. \fINote:\fR Homebrew will only try to print emoji on OS X Lion or newer\.
. .
.TP .TP
\fBHOMEBREW_NO_INSECURE_REDIRECT\fR \fBHOMEBREW_NO_GITHUB_API\fR
If set, Homebrew will not permit redirects from secure HTTPS to insecure HTTP\. Homebrew will not use the GitHub API, e\.g\. for searches or fetching relevant issues on a failed install\.
.
.IP
While ensuring your downloads are fully secure, this is likely to cause from\-source SourceForge, some GNU & GNOME based formulae to fail to download\.
. .
.TP .TP
\fBHOMEBREW_NO_GITHUB_API\fR \fBHOMEBREW_NO_INSECURE_REDIRECT\fR
If set, Homebrew will not use the GitHub API, e\.g\. for searches or fetching relevant issues on a failed install\. Homebrew will not permit redirects from secure HTTPS to insecure HTTP\.
.
.IP
\fINote:\fR While ensuring your downloads are fully secure, this is likely to cause from\-source SourceForge, some GNU & GNOME based formulae to fail to download\.
. .
.TP .TP
\fBHOMEBREW_NO_INSTALL_CLEANUP\fR \fBHOMEBREW_NO_INSTALL_CLEANUP\fR
If set, \fBbrew install\fR, \fBbrew upgrade\fR and \fBbrew reinstall\fR will never automatically cleanup the installed/upgraded/reinstalled formulae or all formulae every 30 days\. \fBbrew install\fR, \fBbrew upgrade\fR and \fBbrew reinstall\fR will never automatically cleanup installed/upgraded/reinstalled formulae or all formulae every 30 days\.
. .
.TP .TP
\fBHOMEBREW_PRY\fR \fBHOMEBREW_PRY\fR
If set, Homebrew will use Pry for the \fBbrew irb\fR command\. Homebrew will use Pry for the \fBbrew irb\fR command\.
.
.TP
\fBHOMEBREW_SKIP_OR_LATER_BOTTLES\fR
Along with \fBHOMEBREW_DEVELOPER\fR Homebrew will not use bottles from older versions of macOS\. This is useful in Homebrew development on new macOS versions\.
. .
.TP .TP
\fBHOMEBREW_SVN\fR \fBHOMEBREW_SVN\fR
When exporting from Subversion, Homebrew will use \fBHOMEBREW_SVN\fR if set, a Homebrew\-built Subversion if installed, or the system\-provided binary\. Forces Homebrew to use a particular \fBsvn\fR binary\. Otherwise, a Homebrew\-built Subversion if installed, or the system\-provided binary\.
.
.IP
Set this to force Homebrew to use a particular \fBsvn\fR binary\.
. .
.TP .TP
\fBHOMEBREW_TEMP\fR \fBHOMEBREW_TEMP\fR
If set, instructs Homebrew to use \fBHOMEBREW_TEMP\fR as the temporary directory for building packages\. This may be needed if your system temp directory and Homebrew prefix are on different volumes, as macOS has trouble moving symlinks across volumes when the target does not yet exist\. Instructs Homebrew to use \fBHOMEBREW_TEMP\fR as the temporary directory for building packages\. This may be needed if your system temp directory and Homebrew prefix are on different volumes, as macOS has trouble moving symlinks across volumes when the targetdoes not yet exist\. This issue typically occurs when using FileVault or custom SSDconfigurations\.
. .
.IP .IP
This issue typically occurs when using FileVault or custom SSD configurations\. \fIDefault:\fR macOS: \fB/private/tmp\fR, Linux: \fB/tmp\fR\.
. .
.TP .TP
\fBHOMEBREW_UPDATE_TO_TAG\fR \fBHOMEBREW_UPDATE_TO_TAG\fR
If set, instructs Homebrew to always use the latest stable tag (even if developer commands have been run)\. Instructs Homebrew to always use the latest stable tag (even if developer commands have been run)\.
. .
.TP .TP
\fBHOMEBREW_VERBOSE\fR \fBHOMEBREW_VERBOSE\fR
If set, Homebrew always assumes \fB\-\-verbose\fR when running commands\. Homebrew always assumes \fB\-\-verbose\fR when running commands\.
. .
.TP .TP
\fBhttp_proxy\fR \fBHOMEBREW_VERBOSE_USING_DOTS\fR
Sets the HTTP proxy to be used by \fBcurl\fR, \fBgit\fR and \fBsvn\fR when downloading through Homebrew\. Homebrew\'s verbose output will print a \fB\.\fR no more than once a minute\. This can be useful to avoid long\-running Homebrew commands being killed due to no output\.
.
.TP
\fBhttps_proxy\fR
Sets the HTTPS proxy to be used by \fBcurl\fR, \fBgit\fR and \fBsvn\fR when downloading through Homebrew\.
. .
.TP .TP
\fBall_proxy\fR \fBall_proxy\fR
Sets the SOCKS5 proxy to be used by \fBcurl\fR, \fBgit\fR and \fBsvn\fR when downloading through Homebrew\. Sets the SOCKS5 proxy to be used by \fBcurl\fR(1), \fBgit\fR(1) and \fBsvn\fR(1) when downloading through Homebrew\.
. .
.TP .TP
\fBftp_proxy\fR \fBftp_proxy\fR
Sets the FTP proxy to be used by \fBcurl\fR, \fBgit\fR and \fBsvn\fR when downloading through Homebrew\. Sets the FTP proxy to be used by \fBcurl\fR(1), \fBgit\fR(1) and \fBsvn\fR(1) when downloading through Homebrew\.
.
.TP
\fBhttp_proxy\fR
Sets the HTTP proxy to be used by \fBcurl\fR(1), \fBgit\fR(1) and \fBsvn\fR(1) when downloading through Homebrew\.
.
.TP
\fBhttps_proxy\fR
Sets the HTTPS proxy to be used by \fBcurl\fR(1), \fBgit\fR(1) and \fBsvn\fR(1) when downloading through Homebrew\.
. .
.TP .TP
\fBno_proxy\fR \fBno_proxy\fR
Sets the comma\-separated list of hostnames and domain names that should be excluded from proxying by \fBcurl\fR, \fBgit\fR and \fBsvn\fR when downloading through Homebrew\. Sets the comma\-separated list of hostnames and domain names that should be excluded from proxying by \fBcurl\fR(1), \fBgit\fR(1) and \fBsvn\fR(1) when downloading through Homebrew\.
. .
.SH "USING HOMEBREW BEHIND A PROXY" .SH "USING HOMEBREW BEHIND A PROXY"
Set the \fBhttp_proxy\fR, \fBhttps_proxy\fR, \fBall_proxy\fR, \fBftp_proxy\fR and/or \fBno_proxy\fR environment variables documented above\. Set the \fBhttp_proxy\fR, \fBhttps_proxy\fR, \fBall_proxy\fR, \fBftp_proxy\fR and/or \fBno_proxy\fR environment variables documented above\.