Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

brew-file fails on 'brew list' #103

Closed
zcutlip opened this issue Dec 21, 2020 · 8 comments
Closed

brew-file fails on 'brew list' #103

zcutlip opened this issue Dec 21, 2020 · 8 comments

Comments

@zcutlip
Copy link

zcutlip commented Dec 21, 2020

when updating or installing formulae or initializing a brewfile, brew-file fails due to the following error generated by brew:

Error: Calling `brew list` to only list formulae is disabled! Use `brew list --formula` instead.
[ERROR]: Failed at command: /usr/local/bin/brew list

Installed versions:

Homebrew 2.7.0-2-g6994633
Homebrew/homebrew-core (git revision 84c6c; last commit 2020-12-21)
Homebrew/homebrew-cask (git revision 4c792e; last commit 2020-12-21)
brew-file v8.2.0 29/Nov/2020
@zcutlip
Copy link
Author

zcutlip commented Dec 21, 2020

Somehow I'd gotten on the development branch of brew again. But when I switched back to stable it still doesn't work:

❱ brew-file --version
Homebrew 2.7.0
Homebrew/homebrew-core (git revision 84c6c; last commit 2020-12-21)
Homebrew/homebrew-cask (git revision ef90d1; last commit 2020-12-21)
brew-file v8.2.0 29/Nov/2020
❱ brew file update
$ brew update
Updated 1 tap (homebrew/cask).
==> Updated Casks
macbreakz
macspice
$ brew upgrade --fetch-HEAD
$ brew upgrade --cask
Error: Calling `brew list` to only list formulae is disabled! Use `brew list --formula` instead.
[ERROR]: Failed at command: /usr/local/bin/brew list

@rcmdnk
Copy link
Owner

rcmdnk commented Dec 22, 2020

Thanks for letting me know!
It came faster than I expected 😰
(I think it should be written in the blog)...

Fixed version brew-file v8.3.0 was released.
It should at least fix brew file init problem.

@rcmdnk
Copy link
Owner

rcmdnk commented Dec 22, 2020

In addition, brew cask install/brew cask uninstall were disabled.
v8.3.1 was released to fix for them.

@zcutlip
Copy link
Author

zcutlip commented Dec 22, 2020

brew file update now works. Thank you!

In addition, brew cask install/brew cask uninstall were disabled.
v8.3.1 was released to fix for them.

This change doesn't seem to have taken:

❱ brew-file --version
Homebrew 2.7.0
Homebrew/homebrew-core (git revision 7fc386; last commit 2020-12-22)
Homebrew/homebrew-cask (git revision 7f6f9; last commit 2020-12-22)
brew-file v8.3.1 23/Dec/2020
❱ brew cask install brave
Error: Calling brew cask install is disabled! Use brew install [--cask] instead.
❱

@rcmdnk
Copy link
Owner

rcmdnk commented Dec 23, 2020

v8.3.1 fixed brew file init command which executed brew cask install at the old version.

About brew cask command at the command line,
it could be used by changing brew-wrap (or brew subcommand of brew-file).
I was also thinking about such a change, but I think it is better not to use non-brew commands in brew-file to avoid confusions.

@zcutlip
Copy link
Author

zcutlip commented Dec 24, 2020

If course! I don't know what I was thinking.🤦‍♂️

I guess I typed it the old way from muscle memory.

I did discover that if I install a cask with the --cask option everything that isn't a cask gets deleted from my brewfile. If I just use the brew install command, omitting --cask, it works as expected. Here are a couple examples:

Installing without --cask

❱ brew install brave-browser
...(output truncated)
🍺  brave-browser was successfully installed!

...(output truncated)

❱ git diff brewfile/Brewfile
diff --git a/brewfile/Brewfile b/brewfile/Brewfile
index 00bbd53..600a9f8 100644
--- a/brewfile/Brewfile
+++ b/brewfile/Brewfile
@@ -95,6 +95,9 @@ brew speedtest
 tap vitorgalvao/tiny-scripts
 brew cask-repair

+# Other Homebrew packages
+brew brave-browser
+
 # Additional files
 file ./${HOSTNAME}-mas.Brewfile
 file ./${HOSTNAME}.Brewfile

Installing with --cask

❱ brew install --cask brave-browser
...(output truncated)
🍺  brave-browser was successfully installed!
...(output truncated)
❱ git diff brewfile/Brewfile | cat
diff --git a/brewfile/Brewfile b/brewfile/Brewfile
index 00bbd53..3de2c16 100644
--- a/brewfile/Brewfile
+++ b/brewfile/Brewfile
@@ -1,75 +1,10 @@

 # tap repositories and their packages

-tap homebrew/core
-brew ack
-brew aria2
-brew automake
-brew bash-completion
-brew cmake
-brew coreutils
-brew cppcheck
-brew ctags
-brew dasm
-brew dockutil
-brew doxygen
-brew dpkg
-brew emacs
-brew gist
-brew git-filter-repo
-brew gocr
-brew hugo
-brew jq
-brew ldid
-brew libmagic
-brew libusbmuxd
-brew libyaml
-brew loc
-brew man2html
-brew mas
-brew minicom
-brew most
-brew mtr
-brew nmap
-brew node
-brew oath-toolkit
-brew ocrmypdf
-brew openjdk
-brew pandoc
-brew pdfcrack
-brew poppler
-brew pv
-brew [email protected]
-brew [email protected]
-brew qrencode
-brew reattach-to-user-namespace
-brew sf-pwgen
-brew shellcheck
-brew sloccount
-brew socat
-brew sphinx-doc
-brew ssh-copy-id
-brew the_silver_searcher
-brew tldr
-brew tmux
-brew tmux-mem-cpu-load
-brew tofrodos
-brew trash
-brew tree
-brew unicorn
-brew watch
-brew wget
-
-tap homebrew/bundle
-
-tap homebrew/cask-drivers
-
 tap homebrew/cask-fonts
 cask font-hack-nerd-font
 cask font-jetbrains-mono

-tap homebrew/cask-versions
-
 tap homebrew/cask
 cask 1password-cli
 cask adoptopenjdk
@@ -86,15 +21,6 @@ cask simplistic
 cask visual-studio-code
 cask wireshark

-tap rcmdnk/file
-brew brew-file
-
-tap teamookla/speedtest
-brew speedtest
-
-tap vitorgalvao/tiny-scripts
-brew cask-repair
-
 # Additional files
 file ./${HOSTNAME}-mas.Brewfile
 file ./${HOSTNAME}.Brewfile

@rcmdnk
Copy link
Owner

rcmdnk commented Dec 25, 2020

The problem was that an option abbreviation was enabled and --cask enabled --caskonly.

It was disabled.
In addition, I changed how to update after brew install <package> when brew-wrap is used:

  • Before(<v8.3.2): Check package list in Brewfile and add in the Brewfile (do not use brew list).
  • After(>=8.3.2): Do exactly same as brew file init after installing package (Use brew list (--formula/--cask))

This will add Cask packages as cask in Brewfile.
In the above case, Cask package brave-browser was added as brew brave-browser,
but it must be added as cask brave-browser.
It is now not able to be distinguished by the command if it is Formula or Cask,
then full brew file init is necessary.
(It can be checked by only brew list --cask, but there are only small difference to do entire initialization.)

It makes an additional delay after brew install (or brew uninstall),
but brew command itself is not so fast now...,
so I think (I hope) it does not makes so much unpleasant feelings.

@zcutlip
Copy link
Author

zcutlip commented Apr 22, 2021

Sorry, I didn't realize I left this open. This has been working great since December.

@zcutlip zcutlip closed this as completed Apr 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants