Reputation: 500
During package installation via homebrew on macOS, if my network is not stable and one download fails, homebrew will download the source and start building from source. This will take a long time and high CPU usage, which is unwanted. How can I tell homebrew retry or just stop when downloading fails?
==> Downloading https://homebrew.bintray.com/bottles/sqlite-3.27.1.mojave.bottle.tar.gz
curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to homebrew.bintray.com:443
Error: Failed to download resource "sqlite"
Download failed: https://homebrew.bintray.com/bottles/sqlite-3.27.1.mojave.bottle.tar.gz
Warning: Bottle installation failed: building from source.
==> Downloading https://sqlite.org/2019/sqlite-autoconf-3270100.tar.gz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/sqlite/3.27.1 --enable-dynamic-extensions --enable-readline --disable-editline
^C
Upvotes: 6
Views: 4852
Reputation: 98
Late answer but another way to make it fail without building from source is setting the HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK
environment variable explained in the man page, e.g. export HOMEBREW_NO_BOTTLE_SOURCE_FALLBACK=1
.
I haven't tested it yet, as I found the solution after I needed it.
Upvotes: 8
Reputation: 19849
You can brew fetch --retry <formula>
to retry the fetching if it fails. Once the bottle is fetched, you can brew install
it.
Combine both commands with:
brew fetch --retry <formula> && brew install <formula>
Upvotes: 3