#12466·packer

'packer -autocomplete-install' breaks filename completion

Author: HariSekhonCreated Jun 9, 2023Updated Jul 11, 2026
Labelsbug

Community Note

  • Please vote on this issue by adding a reaction to the original issue to help the community and maintainers prioritize this request
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment

When filing a bug, please include the following headings if possible. Any example text in this template can be deleted.

Overview of the Issue

Running

packer -autocomplete-install

works to add packer <tab> completion such as the build command, but breaks the more useful filename autocompletion in bash on Mac (using both stock 3.2.57(1)-release and newer brew installed Bash 5.2.15(1)-release - with the same result)

Reproduction Steps

bash
git clone https://github.com/HariSekhon/Packer-templates pack

cd pack

packer build ubuntu-arm64.qemu<tab>  

# works to fill in the rest of the filename

packer -autocomplete-install

bash -login  # to get the .bash_profile injected complete command to run

packer bui<tab>   # now works to autocomplete the 'build' command

# but

packer build ubuntu-arm64.qemu<tab>   # no longer autocompletes the filename

Workaround - remove packer autocompletion:

complete -r packer

packer build ubuntu-arm64.qemu<tab>  # now works again

Permanently remove this broken autocompletion:

rm -fv /usr/local/etc/bash_completion.d/packer
rm -fv /opt/homebrew/etc/bash_completion.d/packer
gsed -i '/^complete.*packer packer$/d' ~/.bash_profile

Packer version

packer version
Packer v1.9.1

Operating system and Environment details

Mac M1 running macOS Ventura 13.4 & Mac Intel running macOS Big Sur 11.7

using both Bash 3.2.57(1)-release and 5.2.15(1)-release