homebrew-file icon indicating copy to clipboard operation
homebrew-file copied to clipboard

Cannot run "brew init" while following getting-started guide

Open aloyr opened this issue 1 year ago • 7 comments

to reproduce

run:

brew init

after having installed it with brew install rcmdnk/file/brew-file and adding the following lines to ~/.bashrc:

if [ -f $(brew --prefix)/etc/brew-wrap ];then
  source $(brew --prefix)/etc/brew-wrap
fi

results

brew init
Do you want to set a repository (y)? ((n) for local Brewfile). [y/n]: n
Traceback (most recent call last):
  File "/opt/homebrew/bin/brew-file", line 3646, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/homebrew/bin/brew-file", line 3633, in main
    b.execute()
  File "/opt/homebrew/bin/brew-file", line 2954, in execute
    _ = self.initialize()
        ^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/bin/brew-file", line 2165, in initialize
    self.get_installed_packages()
  File "/opt/homebrew/bin/brew-file", line 1970, in get_installed_packages
    p, info[p]
       ~~~~^^^
KeyError: 'python-certifi'

also, no files nor folders under ~/.config/brewfile. not even that folder exists.

expected results

no errors

my environment (from neofetch)

OS: macOS 14.5 23F79 arm64
Host: MacBookPro18,2
Kernel: 23.5.0
Uptime: 5 days, 19 hours, 34 mins
Packages: 1 (port), 318 (brew)
Shell: bash 5.2.32
Resolution: 1728x1117@2x
DE: Aqua
WM: Quartz Compositor
WM Theme: Blue (Light)
Terminal: tmux
CPU: Apple M1 Max
GPU: Apple M1 Max
Memory: 5472MiB / 32768MiB
Disk (/): 12G / 1.8T (15%)
Battery: 91%

aloyr avatar Sep 07 '24 11:09 aloyr

It seems same problem as #265.

Could you please run:

command brew update & command brew upgrade

then try:

brew init

rcmdnk avatar Sep 07 '24 14:09 rcmdnk

i ran command brew update & command brew upgrade then re-ran

brew install rcmdnk/file/brew-file

and added the following to my ~/.bashrc file:

if [ -f $(brew --prefix)/etc/brew-wrap ];then
  source $(brew --prefix)/etc/brew-wrap
fi

running brew init and selecting no repo or repo option give me the same output:

brew init
Do you want to set a repository (y)? ((n) for local Brewfile). [y/n]: n
Traceback (most recent call last):
  File "/opt/homebrew/bin/brew-file", line 3646, in <module>
    sys.exit(main())
             ^^^^^^
  File "/opt/homebrew/bin/brew-file", line 3633, in main
    b.execute()
  File "/opt/homebrew/bin/brew-file", line 2954, in execute
    _ = self.initialize()
        ^^^^^^^^^^^^^^^^^
  File "/opt/homebrew/bin/brew-file", line 2165, in initialize
    self.get_installed_packages()
  File "/opt/homebrew/bin/brew-file", line 1970, in get_installed_packages
    p, info[p]
       ~~~~^^^
KeyError: 'python-certifi'

aloyr avatar Sep 29 '24 23:09 aloyr

Could you please check and give me the result of following command?

$ brew ls | grep certifi

rcmdnk avatar Sep 30 '24 04:09 rcmdnk

I have the same issue.

The output of

command brew update & command brew upgrade

was:

command brew update & command brew upgrade
[1] 26104
==> Updating Homebrew...
Already up-to-date.

[1]  + 26104 done       command brew update

but the problem still persists.

The output of:

$ brew ls | grep certifi

is:

ca-certificates
certifi
python-certifi

tygore587 avatar Oct 04 '24 20:10 tygore587

python-certifi and certifi are formulae for the same package. I'm not sure why both of them can exist in the same time. Any special taps are there...?

Anyway, there is something wrong in brew system (not brew-file), I think it is better to do something like:

$ brew rm python-certifi
$ brew rm certify
$ brew cleanup
$ rm -rf $(brew --cache)

Then re-install certify again.

rcmdnk avatar Oct 04 '24 20:10 rcmdnk

I didn't install it myself, so maybe its part of some other dependency?

I have the following taps:

homebrew/bundle
homebrew/cask-versions
homebrew/services
oven-sh/bun
rcmdnk/file
superatomic/bundle-extensions

I will try running the commands and will report. Thanks for your help.

EDIT: Running brew rm python-certifi results in the following error:

Error: Refusing to uninstall /opt/homebrew/Cellar/certifi/2024.8.30
because it is required by streamlink and yt-dlp, which are currently installed.
You can override this and force removal with:
  brew uninstall --ignore-dependencies python-certifi

and running brew rm certifi in:

Error: Refusing to uninstall /opt/homebrew/Cellar/certifi/2024.8.30
because it is required by streamlink and yt-dlp, which are currently installed.
You can override this and force removal with:
  brew uninstall --ignore-dependencies certifi

And got another hint:

brew rm python-certifi
Warning: Formula python-certifi was renamed to certifi.
Warning: Formula python-certifi was renamed to certifi.
Warning: Formula python-certifi was renamed to certifi.
Error: No such keg: /opt/homebrew/Cellar/python-certifi

Maybe the rename created this bug that both can exist.

tygore587 avatar Oct 04 '24 21:10 tygore587

Thanks, it worked :)

tygore587 avatar Oct 04 '24 21:10 tygore587