Install Azure CLI 2.0 on macOS
For the macOS platform, you can install the Azure CLI with homebrew package manager. Homebrew makes it easy to keep your installation of the CLI update to date. The CLI package has been tested on macOS versions 10.9 and later.
Homebrew is the easiest way to manage your 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 CLI by updating your brew repository information, and then running the
brew update && brew install azure-cli
You can then run the Azure CLI with the
az command. To sign in, use az login command.
If the CLI can open your default browser, it will do so and load a sign-in page.
Otherwise, you need to open a browser page and follow the instructions on the command line to enter an authorization code after navigating to https://aka.ms/devicelogin in your browser.
Sign in with your account credentials in the browser.
To learn more about different authentication methods, see Sign in with Azure CLI 2.0.
If you encounter a problem when installing the CLI through Homebrew, here are some common errors. If you experience a problem not covered here, file an issue on github.
Unable to find Python or installed packages
There may be a minor version mismatch or other issue during homebrew installation. The 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
python3 dependency from Homebrew.
brew update && brew install python3 && brew upgrade python3 brew link --overwrite python3
CLI version 1.x is installed
If an out-of-date version was installed, it could be because of a stale homebrew cache. Follow the update instructions.
The CLI is regularly updated with bug fixes, improvements, new features, and preview functionality. A new release is available roughly every
two weeks. Update your local repository information and then upgrade the
brew update && brew upgrade azure-cli
If you decide to uninstall the Azure CLI, we're sorry to see you go. Before you uninstall, use the
az feedback command to let us know
what could be improved or fixed. Our goal is to make the Azure CLI bug-free and user-friendly. If you found a bug, we'd appreciate it if you file a GitHub issue.
Use homebrew to uninstall the
brew uninstall azure-cli