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 Terminal on macOS. This will open up a bash shell 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 | 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 typeY‘ 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:

Happy scripting!

Posted by Chris Pietschmann

Chris is a Microsoft MVP and has nearly 20 years of experience building enterprise systems both in the cloud and on-premises. He is also a Certified Microsoft Azure Solutions Architect (both MCSD and MCSE), a Microsoft Certified Trainer, and self proclaimed Cloud Advocate. He has a passion for technology and sharing what he learns with others to help enable them to learn faster and be more productive.


  1. 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.


    1. Chris Pietschmann January 15, 2018 at 5:57 pm

      Awesome, glad I could help!


  2. 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.


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.