Skip to content

Don't duplicate PATH entries #14560

@allanlewis

Description

@allanlewis

Verification

Provide a detailed description of the proposed feature

Currently, brew-shellenv prepends /usr/local/bin and /usr/local/sbin to PATH. On Mac OS (I haven't checked multiple versions) /usr/local/bin is already at or near the beginning of PATH so it's unnecessary. My proposal is that Homebrew checks if each directory is already in PATH and, if so, either doesn't add it again or deletes the existing entry before prepending it.

What is the motivation for the feature?

This will remove duplicate entries from PATH on Mac OS, and on any system where /usr/local/bin or /usr/local/sbin is already in PATH when brew shellenv is run.

How will the feature be relevant to at least 90% of Homebrew users?

I presume the majority of Homebrew users are using recent versions of Mac OS, so they probably have this issue of duplicate PATH entries.

What alternatives to the feature have been considered?

Users could instead deduplicate their PATHs after running brew shellenv.

Metadata

Metadata

Assignees

No one assigned

    Labels

    outdatedPR was locked due to age

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions