I’m having trouble enabling autocompletion on a fresh MacOS terraform install.
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
This resulted in adding the following to my
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.
Does anyone know how to get this working without having to install even more software like homebrew, oh-my-zsh etc.?
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