| title | Install Azure CLI on macOS | Microsoft Docs |
|---|---|
| description | Learn how to install and run the Azure CLI on macOS using the homebrew package manager. The Azure CLI package requires macOS 13 or higher. |
| ms.service | azure-cli |
| ms.custom | devx-track-azurecli |
| keywords | Install azure cli, azure cli macos, macos cli, install azure cli macos |
The Azure Command-Line Interface (CLI) is a cross-platform command-line tool that can be installed locally on macOS computers. You can use the Azure CLI to connect to Azure and execute administrative commands on Azure resources using interactive command-line prompts or a script.
For the macOS platform, install the Azure CLI with homebrew package manager. Homebrew makes it easy to keep your installation of the Azure CLI up to date. The Azure CLI package requires macOS 13 or higher.
[!INCLUDE current-version]
Homebrew is the easiest way to manage your Azure CLI install. It provides convenient ways to install, update, and uninstall. If you don't have homebrew available on your system, install homebrew before continuing.
You can install the Azure CLI on macOS by updating your brew repository information, and then
running the install command:
brew update && brew install azure-cliIf you encounter a problem when installing the Azure CLI through Homebrew, here are some common errors. If you experience a problem not covered here, file an issue on GitHub.
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, 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/azThere might be a minor version mismatch or other issue during homebrew installation. The Azure CLI
doesn't use a Python virtual environment, so it relies on finding the installed Python version. A
possible fix is to install and relink the [email protected] dependency from Homebrew.
brew update && brew install [email protected] && brew upgrade [email protected]
brew link --overwrite [email protected]If an out-of-date version was installed, it could be because of a stale homebrew cache. Follow the update instructions.
You might be unable to get resources from Homebrew unless you configure it to use your proxy. Follow the Homebrew proxy configuration instructions.
Important
If you are behind a proxy, HTTP_PROXY and HTTPS_PROXY must be set to connect to Azure services
with the Azure CLI. If you don't use basic auth, you should export these variables in your
.bashrc file. Always follow your business' security policies and the requirements of your system
administrator.
To get the bottle resources from Homebrew, your proxy needs to allow HTTPS connections to the following addresses:
https://formulae.brew.shhttps://homebrew.bintray.com
The Azure CLI is regularly updated with bug fixes, improvements, new features, and preview functionality. A new release is available about once a month.
[!INCLUDE az-upgrade]
You can also update your local Homebrew repository information and then upgrade the azure-cli
package.
brew update && brew upgrade azure-cli[!INCLUDE uninstall-boilerplate.md]
Use homebrew to uninstall the azure-cli package.
brew uninstall azure-cliIf you don't plan to reinstall the Azure CLI, remove its data.
rm -rf ~/.azureIf you can't use homebrew to install the Azure CLI in your environment, it's possible to use the manual instructions for Linux. This process isn't officially maintained to be compatible with macOS. Using a package manager such as Homebrew is recommended. Only use the manual installation method if you have no other option available.
For the manual installation instructions, see Install Azure CLI on Linux manually.
Now that you installed the Azure CLI on macOS, take a short tour of its features and common commands.
[!div class="nextstepaction"] Get started with the Azure CLI