Skip to content

Improve error/warning when brew install refuses to install a formula from a tap with the same name as an already installed keg #17941

@9999years

Description

@9999years

(Reworded by @MikeMcQuaid)

What did you expect to happen?

I expected Homebrew to be able to install two formulae with the same name from different taps. When this didn't work, I expected the error message to reference this

Step-by-step reproduction instructions (by running brew commands)

$ brew uninstall -f mercurytechnologies/tap/postgresql@16 homebrew/homebrew-core/postgresql@16
Uninstalling postgresql@16... (3,801 files, 68.4MB)

$ brew install homebrew/homebrew-core/postgresql@16
==> Downloading https://ghcr.io/v2/homebrew/core/postgresql/16/manifests/16.3
...
==> Summary
🍺  /opt/homebrew/Cellar/postgresql@16/16.3: 3,801 files, 68.4MB

$ brew install mercurytechnologies/homebrew-tap/postgresql@16
Warning: mercurytechnologies/tap/postgresql@16 16.3 is already installed, it's just not linked.
To link this version, run:
  brew link postgresql@16

Further, brew info will incorrectly claim that mercurytechnologies/tap/postgresql@16 is installed.

$ brew info mercurytechnologies/tap/postgresql@16
==> mercurytechnologies/tap/postgresql@16: stable 16.3
Object-relational database system
https://www.postgresql.org/
Installed
/opt/homebrew/Cellar/postgresql@16/16.3 (3,801 files, 68.4MB)
  Poured from bottle using the formulae.brew.sh API on 2024-08-02 at 12:35:48
From: https://github.com/MercuryTechnologies/homebrew-tap/blob/HEAD/Formula/postgresql@16.rb
License: PostgreSQL
==> Dependencies
Build: pkg-config ✔
Required: gettext ✔, icu4c ✔, krb5 ✔, lz4 ✔, openssl@3 ✔, readline ✔, zstd ✔
==> Caveats
This formula has created a default database cluster with:
  initdb --locale=C -E UTF-8 /opt/homebrew/var/postgresql@16
For more details, read:
  https://www.postgresql.org/docs/16/app-initdb.html

To start mercurytechnologies/tap/postgresql@16 now and restart at login:
  brew services start mercurytechnologies/tap/postgresql@16
Or, if you don't want/need a background service you can just run:
  LC_ALL="C" /opt/homebrew/opt/postgresql@16/bin/postgres -D /opt/homebrew/var/postgresql@16
==> Analytics
install: 6,224 (30 days), 20,812 (90 days), 62,627 (365 days)
install-on-request: 6,117 (30 days), 20,368 (90 days), 60,669 (365 days)
build-error: 11 (30 days)

Related issues

Metadata

Metadata

Assignees

Labels

help wantedWe want help addressing this

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions