MicrosoftDocs / azure-docs-cli

Repository used to store content for the docs.microsoft.com content for the Azure CLI
https://docs.microsoft.com/cli/azure/
Creative Commons Attribution 4.0 International
206 stars 470 forks source link

Install azure-cli on sonoma apple silicon #4220

Open yingding opened 5 months ago

yingding commented 5 months ago

Prerequisites

Azure CLI version being used

2.58.0

Link to affected document

https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-macos

Description of the documentation error

For the section completion isn't working https://learn.microsoft.com/en-us/cli/azure/install-azure-cli-macos#completion-isnt-working

For the apple silicon mac, you need to add the following to the .zshrc

autoload -U +X compinit && compinit
autoload -U +X bashcompinit && bashcompinit
source $(brew --prefix)/etc/bash_completion.d/az

otherwise you will get an error: complete:13: command not found: compdef

Suggested fix

Completion isn't working

The Homebrew formula of Azure CLI installs a completion file named az in the Homebrew-managed completions directory (default location is /usr/local/etc/bash_completion.d/). To enable completion, follow Homebrew's instructions here.

For Zsh on mac(< ventura) , add the following two lines to the bottom of your .zshrc file, then save and reload your zsh profile.

autoload bashcompinit && bashcompinit
source $(brew --prefix)/etc/bash_completion.d/az

For Zsh on mac(>= ventura), add the following three lines to the bottom of your .zshrc file, then save and reload your zsh profile.

autoload -U +X compinit && compinit
autoload -U +X bashcompinit && bashcompinit
source $(brew --prefix)/etc/bash_completion.d/az
ManoharLakkoju-MSFT commented 5 months ago

@yingding Thanks for your feedback! We will investigate and update as appropriate.

dbradish-microsoft commented 2 months ago

@jiasli, Can you kindly verify this information so it can be added to the install doc for macOS?