Brew and shell autocompletion

Hi!

I ran ujust brew to install Homebrew. Because I want to install various command line packages Ito have on the main system. One of them is pass (https://www.passwordstore.org/), which is a password manager.

After reopening my shell and commanding brew install pass it gets installed without issue. But the autocompletion for the shell is not functioning. Which is… exhausting. I feel I am missing something in my brew setup?

I have reopened my terminal. Perhaps it just needs to source it? Nope, no completion for pass.
I have rebooted my machine. Perhaps it’s sourced upon login (from profile)? Nope.

I did find brew Shell Completion — Homebrew Documentation and read it. I ran brew completions link, added the shell code to my ~/.bash_profile. No change. I added brew install bash-completion, which conflicted with util-linux but I unlinked that and went on with it, and rebooted. Still zip.

Time to go deeper… But at the same time I cannot imagine that this is normal right? Everything works so nicely and is set-up in a good way from the beginning. Autocompletion is something loads of people use… why is this so different?

If I manually source ${HOMEBREW_PREFIX}/etc/bash_completion.d/pass the autocompletion works as expected. Could be as simple as it not being sourced?

My ~/.bashrc is default, as is my ~/.bash_profile with the Homebrew provided bit added. At the system level the /etc/profile is default and the /etc/profile.d contains a brew.sh file with the following:

[[ -d /home/linuxbrew/.linuxbrew && $- == *i* ]] && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"

Performing this by hand does not run the brew shellenv because when I run it by hand it’s ran in a sub-shell which is not interactive causing $- to not contain i. But… when opening the terminal this should run (I could that that by modifying it).

Running /home/linuxbrew/.linuxbrew/bin/brew shellenv by hand results in no output. Which is expected because reading the help text for that function it contains:

To help guarantee idempotence, this command produces no output when Homebrew’s bin and sbin directories are first and second respectively in your PATH.

Which they are:

❯ echo $PATH
/home/linuxbrew/.linuxbrew/bin:/home/linuxbrew/.linuxbrew/sbin:/var/home/stefan/.local/bin:/var/home/stefan/bin:/usr/local/bin:/usr/local/sbin:/usr/bin:/usr/sbin

So… before I dig deeper… is this normal or did I just miss something?