
The Azure CLI is the cross-platform, command-line tool for managing and automating cloud resources in Microsoft Azure. The tool is supported across macOS, Linux, Windows, and more newly usable from within a web browser in the Azure Portal. While you can run it in the browser now, there are certainly benefit from being able to run the Azure CLI from your local machine. One of these benefits is to easily execute bash scripts locally to perform automation and other tasks. This article will guide you through the step-by-step process of installing the Azure CLI 2.0 on macOS.
Install Azure CLI 2.0 on macOS
Here are the fairly simple steps you can run to install the Azure CLI 2.0 on macOS:
Step 1: Run Terminalon macOS. This will open up a bashshell that you can use to access the command-line on macOS.

Step 2: Within the Terminal, run the following command to install Azure CLI 2.0 with a single command:
curl -L https://aka.ms/InstallAzureCli | bash
Step 3: When prompted with “In what directory would you like to place the install?” you can just hit Return on your keyboard (aka leave it blank) and it’ll install it within “/Users/{username}/lib/azure-cli”.

Step 4: When prompted with “In what directory would you like to place the ‘az’ executable?” you can just hit Return on your keyboard (aka leave it blank) and it’ll install it within “/Users/{username}/bin“.

Step 5: Just sit back and relax while it gets busy installing…

Step 6: When prompted with “Modify profile to update your $PATH and enable shell/tab completion now?” you can type ‘Y‘ and hit Return.

Step 7: If prompted with “Could not automatically find a suitable file to use. Create /Users/{username}/.bash_profile now?” you can type ‘Y‘ and hit Return.

Step 8: You have now successfully installed the Azure CLI 2.0 on macOS!!

Next Steps
Error using ‘az’ command?: If you get a “command not found” error when trying to run Azure CLI 2. commands in the bash shell on macOS after you just installed it, you may need to restart your shell. To do this you can run the following command:
exec -l $SHELL
Running ‘az’ commands: You can just type ‘az‘ to get started running Azure CLI 2.0 commands in the bash shell. If you need some help, with commands you can run the following ‘az‘ command to get some help information:
az -h

If you want some additional help with how to use the Azure CLI 2.0 commands, here are a few links you can reference:
- Azure CLI 1.0 vs 2.0 Compared, Installation and Usage
- Azure CLI 2.0: Manage Resource Groups
- Azure CLI 2.0: Reset Azure SQL Database Password
- Azure CLI 2.0: Generate SAS Token for Blob in Azure Storage
Happy scripting!
Hi Chris, Thanks for your help! Taking an Azure IoT course on Edx and wanted to install Azure CLI on my mac at home. Was having nothing but problems prior to viewing your article above.
Awesome, glad I could help!
Thank you. The “brew” install wasn´t working in any way on my mac. Facing lot of issues. This way you presented works perfectly. Very thanks.
credits to your blog post, I have found (the 2nd googling) on the MS offical page as well: https://docs.microsoft.com/en-us/cli/azure/install-azure-cli-linux?view=azure-cli-latest, but your one has got more explanations, screenshots…
This works for the update purpose as well! Just re-run it and follow the instructions (delete existing…)
Thanks!
Stan
Thank you!