Skip to content

Instantly share code, notes, and snippets.

@richardkmichael
Last active August 29, 2015 14:24
Show Gist options
  • Save richardkmichael/acff67dd8ac1abf74e60 to your computer and use it in GitHub Desktop.
Save richardkmichael/acff67dd8ac1abf74e60 to your computer and use it in GitHub Desktop.
Install bash-completion:master for `shopt -s failglob` with TAB-completion.

bash-completion:master has fixes for TAB-completion breakage when using shopt -s failglob (helpful with shopt -s dotglob).

$ ls -l bash: no match: words[0]=${!ref}${COMP_WORDS[i]}

Unfortunately, Homebrew's bash-completion will always use version 1.3, pinned because of OSX pinning to bash 3.2.x. Also, the homebrew-version/bash-completion2 package is 2.1, which is very old.

So, let's quickly install bash-completion from source until we have time to fix homebrew.

# bash-completion release tarballs include a ./configure; the git repo does not, so we'll need to create one.
brew install autoconf automake

# bash-completion can use BSD (MacOS) awk, but prefers GNU awk.
brew install gawk

# Obtain and build.
git clone git://anonscm.debian.org/bash-completion/bash-completion.git && cd bash-completion

# Avoid AM_INIT_AUTOMAKE undefined macro error.
autoreconf -vfi
./configure # --prefix=/path/to/your/source/software
make

# Sanity check the install.
make -n install

# If ok, install.
make install

Adjust your rc/startup files as necessary.

Further work: fix homebrew

Merge homebrew/homebrew-versions/bash-completion2 and homebrew/bash-completion providing stable (or a better name such as legacy) (1.3) and head (master). bash-completion2 can disappear -- anyone using it is likely using new bash (>4) and really just wants a newer (latest?) version of bash-completion, not specifically 2.1.

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