Solvedazure cli zsh autocompletion on OSX/macOS

Every time I launch my terminal I get the following error: /Users/blake/lib/azure-cli/az.completion:10: command not found: complete I followed the curl -L https://aka.ms/InstallAzureCli | bash docs exactly and the file is there although in a weird location (the default). Is anyone else running into this?

25 Answers

✔️Accepted Answer

I also just encountered this.

$ sw_vers -productVersion
10.12.3
$ zsh --version
zsh 5.2 (x86_64-apple-darwin16.0)
$ echo $SHELL
/bin/zsh

Installed via
$ curl -L https://aka.ms/InstallAzureCli | bash

If I update my .zshrc and add
autoload bashcompinit && bashcompinit

in the line before sourcing azure-cli/az.completion it works fine.

Other Answers:

@niemyjski you are right -
turns out it only worked because I am loading the Google Cloud Platform bash completion script before this.

So it seems that independent of zsh version you must have autoload bashcompinit && bashcompinit in your bashrc before sourcing the Azure bash completion script.

when installing from Brew, now the .zshrc file requires

autoload bashcompinit && bashcompinit
source /usr/local/etc/bash_completion.d/az

paths have changed

More Issues: