diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml
index f1b867f8fd..dd078df819 100644
--- a/.github/workflows/tests.yml
+++ b/.github/workflows/tests.yml
@@ -85,8 +85,6 @@ jobs:
- name: Run brew audit --skip-style on all taps
run: brew audit --eval-all --skip-style --except=version --display-failures-only
- env:
- HOMEBREW_NO_INSTALL_FROM_API: 1
- name: Set up all Homebrew taps
run: |
@@ -98,7 +96,6 @@ jobs:
brew tap homebrew/cask-fonts
brew tap homebrew/cask-versions
brew tap homebrew/command-not-found
- brew tap homebrew/core
brew tap homebrew/formula-analytics
brew tap homebrew/portable-ruby
brew tap homebrew/services
@@ -112,7 +109,6 @@ jobs:
run: brew audit --skip-style --except=version --tap=homebrew/core
env:
HOMEBREW_SIMULATE_MACOS_ON_LINUX: 1
- HOMEBREW_NO_INSTALL_FROM_API: 1
- name: Run brew style on official taps
run: |
diff --git a/Library/Homebrew/brew.sh b/Library/Homebrew/brew.sh
index fb373a65f8..10ea8630c6 100644
--- a/Library/Homebrew/brew.sh
+++ b/Library/Homebrew/brew.sh
@@ -249,7 +249,7 @@ auto-update() {
if [[ -z "${HOMEBREW_AUTO_UPDATE_SECS}" ]]
then
- if [[ -z "${HOMEBREW_NO_INSTALL_FROM_API}" ]]
+ if [[ -z "${HOMEBREW_NO_INSTALL_FROM_API}" && -n "${HOMEBREW_INSTALL_FROM_API}" ]]
then
# 24 hours
HOMEBREW_AUTO_UPDATE_SECS="86400"
@@ -799,6 +799,25 @@ To turn developer mode off, run $(bold "brew developer off")
export HOMEBREW_DEV_CMD_RUN="1"
fi
+# Test HOMEBREW_INSTALL_FROM_API on HOMEBREW_DEV_CMD_RUN and HOMEBREW_DEVELOPER
+# folks who haven't run a HOMEBREW_DEVELOPER_COMMAND if they are in a default
+# prefix and on a supported macOS version.
+if [[ -z "${HOMEBREW_NO_INSTALL_FROM_API}" &&
+ -z "${HOMEBREW_DEVELOPER_COMMAND}" ]] &&
+ [[ -z "${HOMEBREW_MACOS_VERSION_NUMERIC}" ||
+ "${HOMEBREW_MACOS_VERSION_NUMERIC}" -ge "110000" ]] &&
+ [[ "${HOMEBREW_PREFIX}" == "/usr/local" ||
+ "${HOMEBREW_PREFIX}" == "/opt/homebrew" ||
+ "${HOMEBREW_PREFIX}" == "/home/linuxbrew/.linuxbrew" ]]
+then
+ if [[ -n "${HOMEBREW_DEV_CMD_RUN}" || -n "${HOMEBREW_DEVELOPER}" ]]
+ then
+ export HOMEBREW_INSTALL_FROM_API=1
+ fi
+else
+ unset HOMEBREW_INSTALL_FROM_API
+fi
+
if [[ -f "${HOMEBREW_LIBRARY}/Homebrew/cmd/${HOMEBREW_COMMAND}.sh" ]]
then
HOMEBREW_BASH_COMMAND="${HOMEBREW_LIBRARY}/Homebrew/cmd/${HOMEBREW_COMMAND}.sh"
diff --git a/Library/Homebrew/cmd/formulae.sh b/Library/Homebrew/cmd/formulae.sh
index 7da00f0980..b7fec73180 100644
--- a/Library/Homebrew/cmd/formulae.sh
+++ b/Library/Homebrew/cmd/formulae.sh
@@ -14,6 +14,7 @@ homebrew-formulae() {
# HOMEBREW_CACHE is set by brew.sh
# shellcheck disable=SC2154
if [[ -z "${HOMEBREW_NO_INSTALL_FROM_API}" &&
+ -n "${HOMEBREW_INSTALL_FROM_API}" &&
-f "${HOMEBREW_CACHE}/api/formula.json" ]]
then
local api_formulae
diff --git a/Library/Homebrew/cmd/update.sh b/Library/Homebrew/cmd/update.sh
index 513dabf95e..dfd6d3f49e 100644
--- a/Library/Homebrew/cmd/update.sh
+++ b/Library/Homebrew/cmd/update.sh
@@ -386,7 +386,7 @@ EOS
fi
if [[ -d "${HOMEBREW_CORE_REPOSITORY}" ]] ||
- [[ -z "${HOMEBREW_NO_INSTALL_FROM_API}" ]]
+ [[ -z "${HOMEBREW_NO_INSTALL_FROM_API}" && -n "${HOMEBREW_INSTALL_FROM_API}" ]]
then
HOMEBREW_CORE_AVAILABLE="1"
fi
@@ -566,7 +566,8 @@ EOS
for DIR in "${HOMEBREW_REPOSITORY}" "${HOMEBREW_LIBRARY}"/Taps/*/*
do
- if [[ -z "${HOMEBREW_NO_INSTALL_FROM_API}" && -n "${HOMEBREW_UPDATE_AUTO}" ]] &&
+ if [[ -z "${HOMEBREW_NO_INSTALL_FROM_API}" && -n "${HOMEBREW_INSTALL_FROM_API}" ]] &&
+ [[ -n "${HOMEBREW_UPDATE_AUTO}" ]] &&
[[ "${DIR}" == "${HOMEBREW_CORE_REPOSITORY}" || "${DIR}" == "${HOMEBREW_CASK_REPOSITORY}" ]]
then
continue
@@ -725,7 +726,7 @@ EOS
for DIR in "${HOMEBREW_REPOSITORY}" "${HOMEBREW_LIBRARY}"/Taps/*/*
do
- if [[ -z "${HOMEBREW_NO_INSTALL_FROM_API}" ]] &&
+ if [[ -z "${HOMEBREW_NO_INSTALL_FROM_API}" && -n "${HOMEBREW_INSTALL_FROM_API}" ]] &&
[[ -z "${HOMEBREW_DEVELOPER}" || -n "${HOMEBREW_UPDATE_AUTO}" ]] &&
[[ "${DIR}" == "${HOMEBREW_CORE_REPOSITORY}" ||
"${DIR}" == "${HOMEBREW_CASK_REPOSITORY}" ]]
@@ -767,7 +768,7 @@ EOS
fi
done
- if [[ -z "${HOMEBREW_NO_INSTALL_FROM_API}" ]]
+ if [[ -z "${HOMEBREW_NO_INSTALL_FROM_API}" && -n "${HOMEBREW_INSTALL_FROM_API}" ]]
then
mkdir -p "${HOMEBREW_CACHE}/api"
diff --git a/Library/Homebrew/dev-cmd/tests.rb b/Library/Homebrew/dev-cmd/tests.rb
index fd99820405..2852fdb7d7 100644
--- a/Library/Homebrew/dev-cmd/tests.rb
+++ b/Library/Homebrew/dev-cmd/tests.rb
@@ -225,9 +225,6 @@ module Homebrew
ENV["HOMEBREW_TEST_ONLINE"] = "1" if args.online?
ENV["HOMEBREW_SORBET_RUNTIME"] = "1"
- # TODO: remove this and fix tests when possible.
- ENV["HOMEBREW_NO_INSTALL_FROM_API"] = "1"
-
ENV["USER"] ||= system_command!("id", args: ["-nu"]).stdout.chomp
# Avoid local configuration messing with tests, e.g. git being configured
diff --git a/Library/Homebrew/env_config.rb b/Library/Homebrew/env_config.rb
index 83dff1ce92..e37aeed288 100644
--- a/Library/Homebrew/env_config.rb
+++ b/Library/Homebrew/env_config.rb
@@ -41,7 +41,7 @@ module Homebrew
description: "Run `brew update` once every `HOMEBREW_AUTO_UPDATE_SECS` seconds before some commands, " \
"e.g. `brew install`, `brew upgrade` and `brew tap`. Alternatively, " \
"disable auto-update entirely with HOMEBREW_NO_AUTO_UPDATE.",
- default_text: "86400 (24 hours) or 300 (5 minutes) if HOMEBREW_NO_INSTALL_FROM_API is set.",
+ default_text: "300 (5 minutes) or 86400 (24 hours) if HOMEBREW_INSTALL_FROM_API is set.",
},
HOMEBREW_AUTOREMOVE: {
description: "If set, calls to `brew cleanup` and `brew uninstall` will automatically " \
@@ -231,6 +231,13 @@ module Homebrew
default_text: 'The "Beer Mug" emoji.',
default: "🍺",
},
+ HOMEBREW_INSTALL_FROM_API: {
+ description: "If set, install formulae and casks in homebrew/core and homebrew/cask taps using Homebrew's " \
+ "API instead of needing (large, slow) local checkouts of these repositories. Note, this will " \
+ "only take effect in supported configurations (i.e. using the default Homebrew prefix and, " \
+ "if on macOS, on a supported version).",
+ boolean: true,
+ },
HOMEBREW_LIVECHECK_WATCHLIST: {
description: "Consult this file for the list of formulae to check by default when no formula argument " \
"is passed to `brew livecheck`.",
@@ -314,7 +321,8 @@ module Homebrew
},
HOMEBREW_NO_INSTALL_FROM_API: {
description: "If set, do not install formulae and casks in homebrew/core and homebrew/cask taps using " \
- "Homebrew's API and instead use (large, slow) local checkouts of these repositories.",
+ "Homebrew's API even if `HOMEBREW_INSTALL_FROM_API` is set and instead use (large, slow) " \
+ "local checkouts of these repositories.",
boolean: true,
},
HOMEBREW_NO_INSTALL_UPGRADE: {
@@ -488,7 +496,7 @@ module Homebrew
return false if OS.unsupported_configuration?
return false unless Homebrew.default_prefix?
- ENV["HOMEBREW_NO_INSTALL_FROM_API"].blank?
+ ENV["HOMEBREW_NO_INSTALL_FROM_API"].blank? && ENV["HOMEBREW_INSTALL_FROM_API"].present?
end
end
end
diff --git a/docs/Installation.md b/docs/Installation.md
index 1f9ed0ff49..bb905abc5d 100644
--- a/docs/Installation.md
+++ b/docs/Installation.md
@@ -25,16 +25,16 @@ export HOMEBREW_CORE_GIT_REMOTE="..." # put your Git mirror of Homebrew/homebre
The default Git remote will be used if the corresponding environment variable is unset.
-## Default Tap Cloning
+## Skip Tap Cloning (beta)
-You can instruct Homebrew to return to pre-4.0.0 behaviour by cloning the Homebrew/homebrew-core tap during installation by setting the `HOMEBREW_NO_INSTALL_FROM_API` environment variable with the following:
+You can instruct Homebrew to skip cloning the Homebrew/homebrew-core tap during installation by setting the beta `HOMEBREW_INSTALL_FROM_API` environment variable with the following:
```bash
-export HOMEBREW_NO_INSTALL_FROM_API=1
+export HOMEBREW_INSTALL_FROM_API=1
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
```
-This will make Homebrew install formulae and casks from the `homebrew/core` and `homebrew/cask` taps using local checkouts of these repositories instead of Homebrew’s API.
+This will make Homebrew install formulae and casks from the `homebrew/core` and `homebrew/cask` taps using Homebrew’s API instead of local checkouts of these repositories.
Note, this will take effect in supported configurations (i.e. using the default Homebrew prefix and, if on macOS, on a supported version).
diff --git a/docs/Manpage.md b/docs/Manpage.md
index 4f860b9e9b..3303878649 100644
--- a/docs/Manpage.md
+++ b/docs/Manpage.md
@@ -1998,7 +1998,7 @@ example, run `export HOMEBREW_NO_INSECURE_REDIRECT=1` rather than just
- `HOMEBREW_AUTO_UPDATE_SECS`
Run `brew update` once every `HOMEBREW_AUTO_UPDATE_SECS` seconds before some commands, e.g. `brew install`, `brew upgrade` and `brew tap`. Alternatively, disable auto-update entirely with HOMEBREW_NO_AUTO_UPDATE.
- *Default:* 86400 (24 hours) or 300 (5 minutes) if HOMEBREW_NO_INSTALL_FROM_API is set.
+ *Default:* 300 (5 minutes) or 86400 (24 hours) if HOMEBREW_INSTALL_FROM_API is set.
- `HOMEBREW_AUTOREMOVE`
If set, calls to `brew cleanup` and `brew uninstall` will automatically remove unused formula dependents and if HOMEBREW_NO_INSTALL_CLEANUP is not set, `brew cleanup` will start running `brew autoremove` periodically.
@@ -2153,6 +2153,9 @@ example, run `export HOMEBREW_NO_INSECURE_REDIRECT=1` rather than just
*Default:* The "Beer Mug" emoji.
+- `HOMEBREW_INSTALL_FROM_API`
+
If set, install formulae and casks in homebrew/core and homebrew/cask taps using Homebrew's API instead of needing (large, slow) local checkouts of these repositories. Note, this will only take effect in supported configurations (i.e. using the default Homebrew prefix and, if on macOS, on a supported version).
+
- `HOMEBREW_LIVECHECK_WATCHLIST`
Consult this file for the list of formulae to check by default when no formula argument is passed to `brew livecheck`.
@@ -2209,7 +2212,7 @@ example, run `export HOMEBREW_NO_INSECURE_REDIRECT=1` rather than just
If set, `brew install`, `brew upgrade` and `brew reinstall` will never automatically cleanup installed/upgraded/reinstalled formulae or all formulae every `HOMEBREW_CLEANUP_PERIODIC_FULL_DAYS` days. Alternatively, HOMEBREW_NO_CLEANUP_FORMULAE allows specifying specific formulae to not clean up.
- `HOMEBREW_NO_INSTALL_FROM_API`
-
If set, do not install formulae and casks in homebrew/core and homebrew/cask taps using Homebrew's API and instead use (large, slow) local checkouts of these repositories.
+
If set, do not install formulae and casks in homebrew/core and homebrew/cask taps using Homebrew's API even if `HOMEBREW_INSTALL_FROM_API` is set and instead use (large, slow) local checkouts of these repositories.
- `HOMEBREW_NO_INSTALL_UPGRADE`
If set, `brew install *`formula`*` will not upgrade `*`formula`*` if it is installed but outdated.
diff --git a/manpages/brew.1 b/manpages/brew.1
index 33db5771f9..0062988a74 100644
--- a/manpages/brew.1
+++ b/manpages/brew.1
@@ -2855,7 +2855,7 @@ Prefix all download URLs, including those for bottles, with this value\. For exa
Run \fBbrew update\fR once every \fBHOMEBREW_AUTO_UPDATE_SECS\fR seconds before some commands, e\.g\. \fBbrew install\fR, \fBbrew upgrade\fR and \fBbrew tap\fR\. Alternatively, disable auto\-update entirely with HOMEBREW_NO_AUTO_UPDATE\.
.
.IP
-\fIDefault:\fR 86400 (24 hours) or 300 (5 minutes) if HOMEBREW_NO_INSTALL_FROM_API is set\.
+\fIDefault:\fR 300 (5 minutes) or 86400 (24 hours) if HOMEBREW_INSTALL_FROM_API is set\.
.
.TP
\fBHOMEBREW_AUTOREMOVE\fR
@@ -3146,6 +3146,12 @@ Print this text before the installation summary of each successful build\.
\fIDefault:\fR The "Beer Mug" emoji\.
.
.TP
+\fBHOMEBREW_INSTALL_FROM_API\fR
+.
+.br
+If set, install formulae and casks in homebrew/core and homebrew/cask taps using Homebrew\'s API instead of needing (large, slow) local checkouts of these repositories\. Note, this will only take effect in supported configurations (i\.e\. using the default Homebrew prefix and, if on macOS, on a supported version)\.
+.
+.TP
\fBHOMEBREW_LIVECHECK_WATCHLIST\fR
.
.br
@@ -3254,7 +3260,7 @@ If set, \fBbrew install\fR, \fBbrew upgrade\fR and \fBbrew reinstall\fR will nev
\fBHOMEBREW_NO_INSTALL_FROM_API\fR
.
.br
-If set, do not install formulae and casks in homebrew/core and homebrew/cask taps using Homebrew\'s API and instead use (large, slow) local checkouts of these repositories\.
+If set, do not install formulae and casks in homebrew/core and homebrew/cask taps using Homebrew\'s API even if \fBHOMEBREW_INSTALL_FROM_API\fR is set and instead use (large, slow) local checkouts of these repositories\.
.
.TP
\fBHOMEBREW_NO_INSTALL_UPGRADE\fR