Skip to content

Instantly share code, notes, and snippets.

@cellularmitosis cellularmitosis/README.md
Last active Oct 15, 2019

Embed
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/*
do
    source "${i}"
done

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

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

(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
You can’t perform that action at this time.