Skip to content

shellenv shell detection is broken for fish #21388

@flowchartsman

Description

@flowchartsman

brew doctor output

n/a

Verification

  • I ran brew update twice and am still able to reproduce my issue.
  • My "brew doctor output" above says Your system is ready to brew or a definitely unrelated Tier message.
  • This issue's title and/or description do not reference a single formula e.g. brew install wget. If they do, open an issue at https://github.com/Homebrew/homebrew-core/issues/new/choose instead.

brew config output

n/a

What were you trying to do (and why)?

Open a shell and have homebrew work.

What happened (include all command output)?

fish: Unknown command: 'fpath[1,0]=/opt/homebrew/share/zsh/site-functions'
~/.config/fish/spec.d/os/darwin/homebrew.fish (line 1):
export HOMEBREW_PREFIX="/opt/homebrew"; export HOMEBREW_CELLAR="/opt/homebrew/Cellar"; export HOMEBREW_REPOSITORY="/opt/homebrew"; fpath[1,0]="/opt/homebrew/share/zsh/site-functions"; eval "$(/usr/bin/env PATH_HELPER_ROOT="/opt/homebrew" /usr/libexec/path_helper -s)" [ -z "${MANPATH-}" ] || export MANPATH=":${MANPATH#:}"; export INFOPATH="/opt/homebrew/share/info:${INFOPATH:-}";

etc...

What did you expect to happen?

Working homebrew commands.

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

  1. run fish shell on MacOS
  2. /opt/homebrew/bin/brew shellenv
  3. Observe the very much not fish shell code you get.

This problem stems from the changes made in #21374, and was reported in #21382, which was closed with the advice to call shellenv fish. I don't think that's an easy solution to find, so I'd like to open another bug. The code may be simplified and that may be a good thing, but now it no longer does something it once did correctly (detect fish shell), and results in inscrutable breakage. That's at the very least a bug or a doc change, though ideally it would come with a grace period for people to make the switch if dropping support was the idea.

It took me quite a while to track down this problem, and I eventually figured out that the upgrade must have changed something and found the (closed) github issue.

Please consider fixing this behavior, or temporarily reverting it and adding a warning for fish shell users for a set grace period. It will avoid a lot of breakage and save people from having to track down the github issue.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions