Skip to content

Instantly share code, notes, and snippets.



Last active Jun 9, 2020
What would you like to do?
Bash completion in Homebrew

Blog 2019/4/24

<- previous | index | next ->

Bash completion in Homebrew

$ brew install bash-completion

You'll need to make sure /usr/local/etc/profile.d/* are being sourced.

I do this by using a ~/.bash_profile which looks like this:

source ${HOME}/.bashrc

for i in ${HOME}/.bash_profile.d/*
    source "${i}"

and then creating ~/.bash_profile.d/homebrew.bash:

for i in `brew --prefix`/etc/profile.d/*
    source "${i}"

(I use the .bash vs. .sh convention to distinguish between "files which you can source" vs. "scripts which you can run".)

To test that this worked, start a new shell and type dd i<TAB><TAB>. The completion options should be ibs= if=.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment