Add homebrew api mirroring environment variables support
Author: XhstormRCreated Apr 19, 2026Updated Jun 13, 2026
Labelstype: featurearea: networkingarea: formula resolutionpriority: mediumstatus: accepted
Add homebrew api mirroring environment variables support: HOMEBREW_API_DOMAIN, HOMEBREW_BOTTLE_DOMAIN
HOMEBREW_API_DOMAIN: {
description: "Use this URL as the download mirror for Homebrew JSON API. " \
"If metadata files at that URL are temporarily unavailable, " \
"the default API domain will be used as a fallback mirror.",
default_text: "`https://formulae.brew.sh/api`.",
default: [HOMEBREW_API_DEFAULT_DOMAIN](https://docs.brew.sh/rubydoc/top-level-namespace.html#HOMEBREW_API_DEFAULT_DOMAIN-constant),
},
HOMEBREW_BOTTLE_DOMAIN: {
description: "Use this URL as the download mirror for bottles. " \
"If bottles at that URL are temporarily unavailable, " \
"the default bottle domain will be used as a fallback mirror. " \
"For example, `export HOMEBREW_BOTTLE_DOMAIN=http://localhost:8080` will cause all bottles " \
"to download from the prefix `http://localhost:8080/`. " \
"If bottles are not available at `$HOMEBREW_BOTTLE_DOMAIN` " \
"they will be downloaded from the default bottle domain.",
default_text: "`https://ghcr.io/v2/homebrew/core`.",
default: [HOMEBREW_BOTTLE_DEFAULT_DOMAIN](https://docs.brew.sh/rubydoc/top-level-namespace.html#HOMEBREW_BOTTLE_DEFAULT_DOMAIN-constant),
}Detail: https://docs.brew.sh/rubydoc/Homebrew/EnvConfig.html
Example usage:
export HOMEBREW_BOTTLE_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles"
export HOMEBREW_API_DOMAIN="https://mirrors.ustc.edu.cn/homebrew-bottles/api"Source: lucasgelfond/zerobrew