Skip to content

info: show other installed versions#22241

Open
HaraldNordgren wants to merge 4 commits into
Homebrew:mainfrom
HaraldNordgren:info-link-state-and-versioned-siblings
Open

info: show other installed versions#22241
HaraldNordgren wants to merge 4 commits into
Homebrew:mainfrom
HaraldNordgren:info-link-state-and-versioned-siblings

Conversation

@HaraldNordgren
Copy link
Copy Markdown
Contributor

@HaraldNordgren HaraldNordgren commented May 12, 2026

Give user info about sibling formulae:

❯ brew info go@1.24
==> go@1.24 ✔: stable 1.24.13 (bottled) [keg-only]
Open source programming language to build simple/reliable/efficient software
https://go.dev/
Deprecated because it is not supported upstream! It will be disabled on 2027-02-11.
Installed (on request)
/opt/homebrew/Cellar/go@1.24/1.24.13_1 (14,126 files, 256.2MB)
  Poured from bottle using the internal formulae.brew.sh API on 2026-05-12 at 09:38:28
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/g/go@1.24.rb
License: BSD-3-Clause
==> Caveats
go@1.24 is keg-only, which means it was not symlinked into /opt/homebrew,
because this is an alternate version of another formula.

If you need to have go@1.24 first in your PATH, run:
  echo 'export PATH="/opt/homebrew/opt/go@1.24/bin:$PATH"' >> ~/.zshrc

The following go@1.24 executables are shadowed by other linked Homebrew commands:
  go (shadowed by /opt/homebrew/bin/go from go)
  gofmt (shadowed by /opt/homebrew/bin/gofmt from go)
Running these by name will not invoke the version provided by Homebrew.
Run `brew link go@1.24` to switch the active version to this keg.
==> Installed versions
  go, go@1.26 (1.26.2) *
  go@1.24 (1.24.13_1)
  go@1.22 (1.22.12)

❯ brew link go@1.24
Unlinking /opt/homebrew/Cellar/go/1.26.2... 2 symlinks removed.
Linking /opt/homebrew/Cellar/go@1.24/1.24.13_1... 2 symlinks created.

❯ brew info go
==> go ↑: 1.26.2 → stable 1.26.3 (bottled), HEAD
Open source programming language to build simple/reliable/efficient software
https://go.dev/
Installed (on request)
/opt/homebrew/Cellar/go/1.26.2 (14,948 files, 228.5MB)
  Poured from bottle using the formulae.brew.sh API on 2026-05-02 at 21:10:21
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/g/go.rb
License: BSD-3-Clause
==> Dependencies
Dependents: 2
==> Options
--HEAD
	Install HEAD version
==> Caveats
The following go executables are shadowed by other linked Homebrew commands:
  go (shadowed by /opt/homebrew/bin/go from go@1.24)
  gofmt (shadowed by /opt/homebrew/bin/gofmt from go@1.24)
Running these by name will not invoke the version provided by Homebrew.
Run `brew link go` to switch the active version to this keg.
==> Installed versions
  go, go@1.26 (1.26.2)
  go@1.24 (1.24.13_1) *
  go@1.22 (1.22.12)

  • Have you followed the guidelines in our Contributing document?
  • Have you checked to ensure there aren't other open Pull Requests for the same change?
  • Have you added an explanation of what your changes do and why you'd like us to include them? Performance claims (e.g. "this is faster") must include Hyperfine benchmarks.
  • Have you written new tests (excluding integration tests) for your changes? Here's an example.
  • Have you successfully run brew lgtm (style, typechecking and tests) with your changes locally?

  • AI was used to generate or assist with generating this PR.

Claud Code, Extra High


@HaraldNordgren HaraldNordgren marked this pull request as ready for review May 12, 2026 09:14
@MikeMcQuaid
Copy link
Copy Markdown
Member

/opt/homebrew/Cellar/go@1.24/1.24.13_1 (14,126 files, 256.2MB)

and

go@1.24 (1.24.13_1) *

both output the same information.

I think if we want to highlight other versions it should avoid duplication.

Also as a general note @HaraldNordgren: I'm getting concerned that we may make brew info less useful if we just keep adding information without removing any. Thoughts?

@HaraldNordgren
Copy link
Copy Markdown
Contributor Author

HaraldNordgren commented May 12, 2026

/opt/homebrew/Cellar/go@1.24/1.24.13_1 (14,126 files, 256.2MB)

and

go@1.24 (1.24.13_1) *

both output the same information.

I don't quite follow this? Do you mean the star for a linked formula, it's quite hidden imo, not sure how many users look here. It's there for a formula without any siblings as well. So for me I would consider dropping it:

/opt/homebrew/Cellar/go/1.26.2 (14,948 files, 228.5MB) *

Also as a general note @HaraldNordgren: I'm getting concerned that we may make brew info less useful if we just keep adding information without removing any. Thoughts?

Could be true! Even if I'm spraying PR's at the moment, these are things I have had in the back of my head for the 10 or so years I've been using Homebrew and teaching my team to use brew, so not just randomly adding stuff 🤗

@HaraldNordgren
Copy link
Copy Markdown
Contributor Author

Or do you mean the location of the keg itself? Yes, that also seems quite specific and not necessarily useful unless the user wants --verbose.

/opt/homebrew/Cellar/go@1.24/1.24.13_1 (14,126 files, 256.2MB)

It doesn't tell me if it's linked or not.

@MikeMcQuaid
Copy link
Copy Markdown
Member

I don't quite follow this? Do you mean the star for a linked formula, it's quite hidden imo, not sure how many users look here. It's there for a formula without any siblings as well. So for me I would consider dropping it:

I mean that this section will output multiple kegs for e.g. go so, if we want to output e.g. some go@another.version kegs: it might make sense to have them "nearby" and in a similar format.

Even if I'm spraying PR's at the moment, these are thing I have had in the back of my head for the 10 or so years I've been using Homebrew and teaching my team to use brew, so not just randomly adding stuff 🤗

Ok good to know 👍🏻

@HaraldNordgren
Copy link
Copy Markdown
Contributor Author

HaraldNordgren commented May 12, 2026

I mean that this section will output multiple kegs for e.g. go so, if we want to output e.g. some go@another.version kegs: it might make sense to have them "nearby" and in a similar format.

@MikeMcQuaid Ah, so you mean collapse the new ==> Installed versions section and instead adding all the version paths up here?

/opt/homebrew/Cellar/go@1.24/1.24.13_1 (14,126 files, 256.2MB)

Maybe, but not necessarily clearer for me as a user. If so, we should add some explanatory text as well!

@MikeMcQuaid
Copy link
Copy Markdown
Member

the new ==> Installed versions section and instead adding all the version paths up here?

Yeh. Or we make that part of the installed versions section and display similar information. I'd like to avoid repetition between sections that are relatively far apart from one another.

@HaraldNordgren HaraldNordgren changed the title info: add installed versions section info: show other installed versions May 12, 2026
@HaraldNordgren
Copy link
Copy Markdown
Contributor Author

the new ==> Installed versions section and instead adding all the version paths up here?

Yeh. Or we make that part of the installed versions section and display similar information. I'd like to avoid repetition between sections that are relatively far apart from one another.

@MikeMcQuaid Moving it down to the installed versions section would look nicer I think, the upper section is quite crowded. However, one complication is that I was not going to show that section when there are no siblings. We need to have a solution that works for any formula.

@MikeMcQuaid
Copy link
Copy Markdown
Member

@MikeMcQuaid Moving it down to the installed versions section would look nicer I think, the upper section is quite crowded. However, one complication is that I was not going to show that section when there are no siblings. We need to have a solution that works for any formula.

Yeh. I think the "installed versions" language makes sense even for the current output? what do you think?

@HaraldNordgren
Copy link
Copy Markdown
Contributor Author

HaraldNordgren commented May 12, 2026

@MikeMcQuaid Updated, looks much nicer! I renamed the section to "Installed" so it wouldn't look weird for formulae without siblings:

❯ brew info go
==> go ↑: 1.26.2 → stable 1.26.3 (bottled), HEAD
Open source programming language to build simple/reliable/efficient software
https://go.dev/
Installed (on request)
  Poured from bottle using the formulae.brew.sh API on 2026-05-02 at 21:10:21
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/g/go.rb
License: BSD-3-Clause
==> Dependencies
Dependents: 2
==> Options
--HEAD
	Install HEAD version
==> Caveats
The following go executables are shadowed by other linked Homebrew commands:
  go (shadowed by /opt/homebrew/bin/go from go@1.24)
  gofmt (shadowed by /opt/homebrew/bin/gofmt from go@1.24)
Running these by name will not invoke the version provided by Homebrew.
Run `brew link go` to switch the active version to this keg.
==> Installed
  go, go@1.26 (1.26.2), /opt/homebrew/Cellar/go/1.26.2 (14,948 files, 228.5MB)
  go@1.24 (1.24.13_1), /opt/homebrew/Cellar/go@1.24/1.24.13_1 (14,126 files, 256.2MB) *
  go@1.22 (1.22.12), /opt/homebrew/Cellar/go@1.22/1.22.12 (12,874 files, 263MB)
==> Analytics
install: 134,503 (30 days), 477,136 (90 days), 1,527,674 (365 days)
install-on-request: 103,957 (30 days), 377,611 (90 days), 1,198,882 (365 days)
build-error: 581 (30 days)
❯ brew info x264
==> x264 ↑: r3108 → stable r3222 (bottled), HEAD
H.264/AVC encoder
https://www.videolan.org/developers/x264.html
Installed (as dependency)
  Poured from bottle using the formulae.brew.sh API on 2024-02-22 at 21:33:27
From: https://github.com/Homebrew/homebrew-core/blob/HEAD/Formula/x/x264.rb
License: GPL-2.0-or-later
==> Dependencies
Dependents: 1
==> Options
--HEAD
	Install HEAD version
==> Installed
  /opt/homebrew/Cellar/x264/r3108 (11 files, 4.5MB) *
==> Analytics
install: 59,048 (30 days), 184,665 (90 days), 460,562 (365 days)
install-on-request: 642 (30 days), 1,856 (90 days), 7,719 (365 days)
build-error: 7 (30 days)

@HaraldNordgren HaraldNordgren force-pushed the info-link-state-and-versioned-siblings branch from 6293853 to 9aa1f4c Compare May 12, 2026 12:30
Copy link
Copy Markdown
Member

@MikeMcQuaid MikeMcQuaid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! More comments.

Comment thread Library/Homebrew/cmd/info.rb Outdated
Comment thread Library/Homebrew/cmd/info.rb Outdated
Comment thread Library/Homebrew/cmd/info.rb Outdated
Comment thread Library/Homebrew/cmd/info.rb Outdated
private

sig { params(shadower: Pathname).returns(T.nilable(String)) }
def sibling_keg_name(shadower)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this related?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's related to avoid the weird wording where we are warning about shadowing that is not solvable by putt Homebrew earlier in their PATH. This is what it currently looks like, when it's actually shadowed by a sibling:

==> Caveats
The following go executables are shadowed by other commands earlier in your PATH:
  go (shadowed by /opt/homebrew/bin/go)
  gofmt (shadowed by /opt/homebrew/bin/gofmt)
Running these by name will not invoke the version provided by Homebrew.

Copy link
Copy Markdown
Contributor Author

@HaraldNordgren HaraldNordgren May 12, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Arguably we could do something something cleaner, I think this is the important part is Run 'brew link go' to switch the active version to this keg, which we could move up to the ==> Installed.

Overall, it's not clear when a formula is not linked. Maybe there should be maybe a warning triangle up here? From a quick glance it looks installed and in effect, which it is not, I have 1.24 linked:

==> go ↑: 1.26.2 → stable 1.26.3 (bottled), HEAD

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

Successfully merging this pull request may close these issues.

2 participants