Skip to content

homebrew is considered only in arm macos #371

@daeho-ro

Description

@daeho-ro

When I see the macos.py,

        is_homebrew = sys.prefix.startswith("/opt/homebrew")
        path_list = [self._append_app_name_and_version("/opt/homebrew/share")] if is_homebrew else []

it only considered the homebrew prefix for arm macos. For intel users, it should be /usr/local. Furthermore, it can be modified by user when they install the homebrew, which means it can be arbitrary.

Without prefix, there is a quite unique path element, that is /opt/python. Homebrew always install the python in the path that

$HOMEBREW_PREFIX/opt/python@$VERSION/Frameworks/Python.framework/Versions/$VERSION

so we may catch the homebrew users by checking the path contains /opt/python. Also, splitting the path by this element can give you the homebrew prefix if you do not plan to read the env HOMEBREW_PREFIX.

Here is my working PR, any feedback is welcome.

Thanks,

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions