Brew.sh retry failed installations
-
How are you guys using
brew
and getting programs that fail to download to retry?IE:
brew cask install adobe-acrobat-pro
failed to download.Yet if I open a new shell and run the same command it works, any pointers?
PS. I realize that this is likely an Internet performance related issue, but there isn't much that I can do to address the underlying cause.
-
I do have this whole setup process scripted, which makes life easier. But it's such a nusiance to have to go back and reinstall the items that failed.
What I've been doing is just rerunning the script as running the install command doesn't effect things already installed. But this seems sloppy.
-
Delete cached packages in ~/Library/Caches/Homebrew/ - this will also wipe plain brew package cache, if you want to limit this to cask, then delete just content of Cask subfolder. That usually solves all installation problems for me.
-
@marcinozga yeah that works for the imcomplete downloads, but how would I automate this? And while I've had a few incomplete downloads to clear out (namely Filezilla) this doesn't appear to be the main issue.
How would I automate retrying to install the failed items?
-
@DustinB3403 With Ansible for example, there's a module for brew package installation, and you can specify task to retry until you get desired result.
-
@marcinozga I've not played with ansible, but maybe I can find something.
-
@DustinB3403 See this:
https://github.com/geerlingguy/ansible-role-homebrew
it's a rather complex role, and it covers complete brew installation, clearing cache and the whole nine yards. If you want to retry it, add following parameters to Cask task, in main.yml file
retries: 2 delay: 5 register: result until: result.rc == 0
so it looks like this
# Cask. - name: Install configured cask applications. homebrew_cask: name: "{{ item }}" state: present install_options: "appdir={{ homebrew_cask_appdir }}" accept_external_apps: "{{ homebrew_cask_accept_external_apps }}" with_items: "{{ homebrew_cask_apps }}" retries: 2 delay: 5 register: result until: result.rc == 0 notify: - Clear homebrew cache
You might have to adjust delay, but that should do the trick.
-
Now I'm getting
Unexpected end of File
FML. . . what changed!