Skip to content

caveats: warn when formula executables are shadowed on PATH#22130

Draft
HaraldNordgren wants to merge 1 commit intoHomebrew:mainfrom
HaraldNordgren:caveats/shadowed-path
Draft

caveats: warn when formula executables are shadowed on PATH#22130
HaraldNordgren wants to merge 1 commit intoHomebrew:mainfrom
HaraldNordgren:caveats/shadowed-path

Conversation

@HaraldNordgren
Copy link
Copy Markdown
Contributor

@HaraldNordgren HaraldNordgren commented May 3, 2026

When a formula installs an executable whose name is already taken by something earlier on the user's PATH (different brew prefix, asdf/mise shim, system tool, manually-installed binary), running the command by name silently invokes the other one. There is currently no signal that this is happening.

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!

This seems like it might be pretty slow? Can you try some before/after benchmarks with hyperfine?

May also warrant an opt-out here.


sig { returns(T.nilable(String)) }
def shadowed_path_text
return if formula.keg_only?
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.

The keg-only formula may be being linked: worth handling that case I think.

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