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 install fails when coreutils is already installed #48

Closed
hairyhenderson opened this issue Apr 8, 2021 · 9 comments
Closed

brew install fails when coreutils is already installed #48

hairyhenderson opened this issue Apr 8, 2021 · 9 comments

Comments

@hairyhenderson
Copy link

On my macOS system that has the coreutils formula already installed:

$  brew install gdu
==> Downloading https://ghcr.io/v2/homebrew/core/gdu/manifests/4.10.0
######################################################################## 100.0%
==> Downloading https://ghcr.io/v2/homebrew/core/gdu/blobs/sha256:9af37b330b0d64a2cc96927f4bd9b005a2c492f8bd084c0a1df531e7b1f003c2
==> Downloading from https://pkg-containers-az.githubusercontent.com/ghcr1/blobs/sha256:9af37b330b0d64a2cc96927f4bd9b005a2c492f8bd084c0a1df531e7b1f003c2?se=2021-04-08T22%3A45%3A00Z&sig=pmNS716JpYgRzbYu9TTTG9o9f94Nx
######################################################################## 100.0%
Error: Cannot install gdu because conflicting formulae are installed.
  coreutils: because both install `gdu` binaries

Please `brew unlink coreutils` before continuing.

Unlinking removes a formula's symlinks from /usr/local. You can
link the formula again after the install finishes. You can --force this
install, but the build may fail or cause obscure side effects in the
resulting software.

In coreutils, they link du to gdu to indicate that it's "GNU du". Personally I'm OK with unlinking coreutils, but this could be surprising to many users.

One suggestion could be to provide a non-conflicting binary as an option (like go-gdu or something?)... Not sure what the best fix is.

And, maybe there's no fix possible - but I just wanted to provide some new-user feedback 😉

@dundee
Copy link
Owner

dundee commented Apr 9, 2021

I know about this conflict, but I also don't know the best solution.

Maybe gdu-go binary name would be even better, it will be easier to guess.

@dundee
Copy link
Owner

dundee commented Apr 9, 2021

I have created pull request to rename it - Homebrew/homebrew-core#74871

@carlocab
Copy link

carlocab commented Apr 9, 2021

You don't actually need to unlink coreutils here. You can just do brew link --overwrite gdu. This will keep all the non-conflicting coreutils binaries linked, but still have gdu point to non-coreutils gdu.

I'm personally not a fan of renaming the binary: I think this is surprising for all your current users, whereas the current situation is surprising for only those who have both gdu and coreutils installed. It's fairly straightforward to work around too (though you do have to do manual linking every time coreutils is updated, which could be annoying).

However, this is your software, so I'm happy to go with whatever you think is best.

@hairyhenderson
Copy link
Author

You can just do brew link --overwrite gdu

Ahh - that's a much better solution IMO. Maybe that could be printed in the error message instead?

@dundee
Copy link
Owner

dundee commented Apr 9, 2021

I think the solution with link --overwrite is quite complicated.

If am not missing something, then you have to unlink the conflicting package first (coreutils), install the second one (gdu) and unlink it. Then link the first one (coreutils) and finally link --overwrite gdu.

@carlocab
Copy link

carlocab commented Apr 9, 2021

No, there is no need to unlink coreutils first. This sequence of steps when you have neither installed works:

brew install coreutils
brew install --force gdu
brew link --overwrite gdu

@dundee
Copy link
Owner

dundee commented Apr 9, 2021

Ah, that's better. Ok, I will close the pull request and update installation instructions for gdu. Thanks both of you!

@dundee dundee closed this as completed in 32f2180 Apr 9, 2021
@brodock
Copy link

brodock commented May 24, 2023

just a FYI, I was using the overwrite but it failed to upgrade recently, it would be nice to reconsider renaming it or at least publish an "alternative" if not only for the sake of keeping backwards compatibility for existing users.

@dundee
Copy link
Owner

dundee commented Jun 23, 2023

@brodock The conflict with coreutils was just removed. Gdu will be installed as gdu-go.

Homebrew/homebrew-core#134731

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

4 participants