Pass Bash AutoCompletion for Mac When Installed With Homebrew

Brian Abbott burnedfaceless at gmail.com
Wed Jun 15 16:57:04 UTC 2022


I recently got Bash autocompletion working for Pass on Mac. I am
running an M1 Macbook Pro that is running macOS Monterey 12.3.1. I
installed pass with homebrew.

Out of the box on Macs pass does not have bash autocomplete at least
when installed with homebrew. The first thing I did was set Bash as
the default shell. This still did not work.

So what I did was download this file
https://github.com/zx2c4/password-store/blob/master/src/completion/pass.bash-completion.
If you run

source pass.bash-completion you will have auto completion working.
However there is an error message. Here's an example: I have a pass
entry for fiverr.com so I typed fiver, hit tab and this is the output

pass -c fiver-bash: compopt: command not found

r.com

So as you can see the autocorrect is working after running

source pass.bash-completion

but there is the compopt: command not found error.

The next thing I did was put

source ~/pass.bash-completion

in ~/.bash_profile, so that the script would run. Obviously I placed
the pass.bash-completion file in my home directory. I should note that
it's not the file from my version of pass and maybe it should be.

To get rid of the compopt error message I simply had to install bash
with homebrew:

brew install bash

Then if you are on an Intel Mac you will add

/usr/local/bin/bash

to /etc/shells

If you are on a M1 Mac you will add

/opt/homebrew/bin/bash

to /etc/shells

Next you will run

chsh -s /usr/local/bin/bash

or

chsh -s /opt/homebrew/bin/bash

depending on whether you are using a M1 Mac or an Intel Mac.

Once this is done your Mac will support bash autocompletion with Homebrew. :)

I want to add a disclaimer that some of these steps might not be
necessary. Almost everyone on this mailing list, if not everyone is
more technical than me. I wanted to shoot this message out so that a
step by step instruction to set up bash autocomplete for pass on Mac
when installed with Homebrew will show up on Google. It's taken me a
few months to figure out how to do this. :)

Obviously in this email chain there might be improvements to these
instructions by more technical people which will be good for whoever
comes across this in the future. :)

Thank you very much to the creator, maintainers and developers of this
script. :)

I'm a Schizophrenic junior level software developer. I lost my 20s to
Schizophrenia and I am just on the edge of my seat at work and in
personal projects :). Life is great. :) My 30s will be spent hacking
away. :)

Brian


More information about the Password-Store mailing list