Skip to content

terraform -install-autocomplete not working on stock macOS Catalina 10.15.5 with default zsh shell #25421

@ratticon

Description

@ratticon

Hi Everyone

I'm having trouble enabling autocompletion on a fresh MacOS terraform install.

Here are the details of the versions I'm running:

OS: macOS Catalina Version 10.15.5
Terminal App: Terminal (default)
Shell: zsh 5.7.1 (x86_64-apple-darwin19.0) (default)
Terraform version: v0.12.28
Path to terraform binary: /usr/local/bin/terraform

At first running the command terraform -install-autocomplete would return:

Error executing CLI: Did not find any shells to install

I noticed that on a fresh OS install there was no .zshrc file in my home directory, so I created one with touch ~/.zshrc and re-ran terraform -install-autocomplete.

This resulted in adding the following to my ~/.zshrc file:

autoload -U +X bashcompinit && bashcompinit
complete -o nospace -C /usr/local/bin/terraform terraform

So I restarted my zsh session and autocomplete does not work. There is an error message that appears beneath the login banner:

complete:13: command not found: compdef

I can work around this by changing my default shell back to Bash, running terraform -uninstall-autocomplete, touching a ~/.profile file and running terraform -install-autocomplete again, but I'd like to use zsh since bash is now deprecated on MacOS.

Kind Regards,

Ben

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions